/**
 * Copyright (c) 2010-2012 EBM WebSourcing, 2012-2013 Linagora
 * 
 * This program/library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or (at your
 * option) any later version.
 * 
 * This program/library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program/library; If not, see <http://www.gnu.org/licenses/>
 * for the GNU Lesser General Public License version 2.1.
 */
package org.ow2.petals.cli;

import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;

public final class Constants {

    private Constants() {
    }

    public final static class CommonOption {

        public static final String BULK_SHORT_OPTION = "b";

        public static final String BULK_LONG_OPTION = "bulk";

        public static final String ARTIFACT_MANAGMENT_USAGE = "-u <url> | -a <artifact-type> <artifact-id>";

        public static final String URL_SHORT_OPTION = "u";

        public static final String URL_LONG_OPTION = "url";

        public static final Option URL_OPTION = OptionBuilder.hasArgs(1)
                .withLongOpt(URL_LONG_OPTION).withArgName("url")
                .withDescription("The local file name or the URL of the artifact to process.")
                .create(URL_SHORT_OPTION);

        public static final String ARTIFACT_SHORT_OPTION = "a";

        public static final String ARTIFACT_LONG_OPTION = "artifact";

        public static final Option ARTIFACT_OPTION = OptionBuilder
                .hasArgs(2)
                .withLongOpt(ARTIFACT_LONG_OPTION)
                .withArgName("<artifact-id> [<artifact-type>]")
                .withDescription(
                        "<artifact-id> is the JBI identifier of the artifact to process.\n"
                                + "<artifact-type> is the nature (SL,BC,SE,SA) of the artifact to process.")
                .create(ARTIFACT_SHORT_OPTION);
    }

    public final static class CommandMessages {

        private CommandMessages() {
        }

        public static final String UNRECOGNIZED_OPTION = "Unrecognized option: -%s";

        public static final String MISSING_COMMAND = "Missing command";

        public static final String UNEXISTING_ALIAS = "This alias does not exist";

        public static final String MISSING_USERNAME_AND_PASSWORD = "The username and password are missing for this alias";

        public static final String NO_DEFAULT_CONNECTION = "No default connection is available. Use 'help connect' for more information";

    }

    public final static class PreferenceFileMessages {

        private PreferenceFileMessages() {
        }

        public static final String UNREADABLE_PREFERENCE_FILE = "Impossible to read the preference file";

        public static final String PREFERENCE_FILE_ERRORS = "The preference file contains %d error(s)";

        public static final String INCORRECT_PROPERTY_VALUE = "the value '%s' for the property '%s' is incorrect.";

        public static final String INCORRECT_PROPERTY_NAME = "the property name '%s' is incorrect.";

        public static final String MISSING_PASSWORD_PROPERTY = "the credentials for '%s' are invalid: add the password or remove the user.";

        public static final String MISSING_USER_PROPERTY = "the credentials for '%s' are invalid: add the user or remove the password.";

        public static final String MISSING_PROPERTY = "the property '%s' is missing.";
    }
}
