package com.atlassian.bitbucket.installer;

import com.atlassian.bitbucket.Product;

public class InstallerConstants {

    /**
     * The key of the installation choice (install or upgrade) in the context.
     */
    public static final String KEY_NEW_INSTALL = "installation.is.new.install";

    /**
     * The key of the installation type in the context.
     */
    public static final String KEY_INSTALLATION_TYPE = "installation.type";

    /**
     * The key for "delete stash user" variable
     */
    public static final String KEY_DELETE_STASH_USER = "delete.atlstash.user";

    /**
     * The key for the summary service label on summary screen
     */
    public static final String KEY_INSTALLER_SUMMARY_SERVICE_LABEL = "summary.service.label";

    /**
     * The version of the present git installed, which is not supported by Bitbucket
     */
    public static final String KEY_GIT_REJECTED_VERSION = "git.rejected.version";

    /**
     * The key in the installer context pointing to the installation details instance
     */
    public static final String KEY_INSTALLATION_DETAILS = "installation.details";

    /**
     * The text shown above the home location path input on the home location choose screen
     */
    public static final String KEY_HOME_DIRECTORY_INFO_TEXT = "home.directory.info.text";

    /**
     * The key for "stash user exists" query result
     */
    public static final String KEY_STASH_USER_QUERY = "stash.user.query.result";

    /**
     * The key for "Delete stash user" label on summary screen
     */
    public static final String KEY_SUMMARY_DELETE_STASH_USER_TEXT = "summary.delete.stash.user.text";

    /**
     * The text of the "Install as service" label on summary screen
     */
    public static final String KEY_SUMMARY_SERVICE_TEXT = "summary.service.text";

    /**
     * Boolean to determine if the service is to be installed or not.
     * This value is to be specified by the user on New Install workflow.
     * But it is always true in Upgrade workflow
     */
    public static final String KEY_APP_INSTALL_SERVICE = "app.install.service";

    /**
     * Boolean to indicate if a previous stash service is found on the OS
     */
    public static final String KEY_APP_SERVICE_EXISTS = "app.service.exists";

    /**
     * Determine if the service label is displayed or not on summary screen.
     * E.g. on upgrade workflow, if there is no service detected, we won't shown this label.
     */
    public static final String KEY_APP_SERVICE_LABEL_VISIBLE = "app.service.label.visible";

    /**
     * The key for the path to bitbucket home
     */
    public static final String KEY_APP_BITBUCKET_HOME = "app.bitbucketHome";

    /**
     * The key for the path to Bitbucket log.
     * This is used when Bitbucket couldn't start up properly, we ask the user to check the Bitbucket log.
     */
    public static final String KEY_STASH_LOG_PATH = "stash.log.path";

    /**
     * The key for the path to Elasticsearch log.
     * This is used when Elasticsearch couldn't start up properly, we ask the user to check the Elasticsearch log.
     */
    public static final String KEY_ELASTICSEARCH_LOG_PATH = "elasticsearch.log.path";

    /*
     * This variable is set in install4j's variable section.
     * Controlling how long the installer launcher will wait for Bitbucket to start up.
     */
    public static final String KEY_APP_STARTUP_TIMEOUT = "app.startup.timeout";

    /**
     * The http port of Bitbucket.
     */
    public static final String KEY_HTTP_PORT = "httpPort";

    /**
     * The installation ID of Bitbucket.
     */
    public static final String KEY_INSTALLATION_ID = "installationID";

    /**
     * The server port of Bitbucket. This could be used to shutdown Bitbucket.
     */
    public static final String KEY_CONTROL_PORT = "serverPort";

    /**
     * This variable will be set to be true if Bitbucket can't be detected on the launching stage.
     */
    public static final String KEY_APP_LAUNCH_ERROR = "app.launch.error";

    /**
     * This variable indicates whether we should skip the Elasticsearch install (used in AMI).
     */
    public static final String KEY_ELASTICSEARCH_INSTALL_SERVICE = "elasticsearch.install.service";

    /**
     * i18n key for the text when git retry action found that git is still mising
     */
    public static final String I18N_ERROR_GIT_RETRY_MISSING = "error.git.retry.missing";

    /**
     * i18n key for the text when git retry action found that the version of git is not supported
     */
    public static final String I18N_ERROR_GIT_RETRY_UNSUPPORTED = "error.git.retry.unsupported";

    /**
     * i18n key for the text when git retry action found that git is present and with a supported version
     */
    public static final String I18N_MESSAGE_GIT_RETRY_SUCCESSFUL = "message.git.retry.successful";

    /**
     * The text for the dialog prompted to the user when he/she wants to continue even the git does not work properly
     */
    public static final String I18N_ERROR_STASH_GIT_IGNORE_MESSAGE = "error.stash.git.ignore.message";

    public static final String I18N_MESSAGE_BUTTON_NO = "message.button.no";
    public static final String I18N_MESSAGE_BUTTON_YES = "message.button.yes";
    public static final String I18N_CONFIGURE_INSTALLATION_HOME_DIRECTORY_INFO_NEW_INSTALL_TEXT = "configure.installation.home.directory.info.new-install.text";
    public static final String I18N_CONFIGURE_INSTALLATION_HOME_DIRECTORY_INFO_UPGRADE_TEXT = "configure.installation.home.directory.info.upgrade.text";
    public static final String I18N_SUMMARY_INSTALL_NEXT_BUTTON_TEXT = "summary.install.next.button.text";
    public static final String I18N_WARNING_SERVICE_OVERRIDE = "warning.service.override";
    public static final String I18N_SUMMARY_SERVICE_LABEL_INSTALL = "summary.service.label.install";
    public static final String I18N_SUMMARY_SERVICE_LABEL_UPGRADE = "summary.service.label.upgrade";
    public static final String I18N_GENERIC_TEXT_NO = "generic.text.no";
    public static final String I18N_GENERIC_TEXT_YES = "generic.text.yes";
    public static final String I18N_ERROR_STASH_GIT_PROBLEM_IGNORE_BUTTON_TEXT = "error.stash.git.problem.ignore.button.text";
    public static final String I18N_SUMMARY_SCREEN_SUBTITLE_CONSOLE = "summary.screen.subtitle.console";
    public static final String I18N_ERROR_DIRECTORY_USED_HOME = "error.directory.used.home";
    public static final String I18N_ERROR_DIRECTORY_USED_INSTALLATION = "error.directory.used.installation";
    public static final String I18N_ERROR_HTTP_PORT_NUMBER_INVALID = "error.invalid.http.port.range";
    public static final String I18N_ERROR_NO_ADMIN_RIGHTS = "error.no.admin.rights";
    public static final String I18N_ERROR_PORT_NUMBER_TOO_LOW = "error.port.number.too.low";
    public static final String I18N_ERROR_SERVER_PORT_NUMBER_INVALID = "error.invalid.server.port.range";
    public static final String I18N_WARNING_MESSAGE_CONTINUE = "warning.message.continue";
    public static final String I18N_WARNING_MESSAGE_EXIT = "warning.message.exit";
    public static final String I18N_WARNING_MESSAGE_INSTALL = "warning.message.install";

    /**
     * There's no vararg version of {@link com.install4j.api.context.Context#getMessage(String, Object[])} and that method
     * is often called with only one {@link Product#NAME} argument. Storing it as a constant here.
     */
    public static final String[] PRODUCT_NAME_ARRAY_WRAP = {Product.NAME};

    public static final int VALUE_EXIT_ERROR_CODE = 1;
}
