// Path: sd-dss-util-cli/src/main/java/it/latraccia/dss/util/cli/argument/converter/DigestAlgorithmConverter.java
// public class DigestAlgorithmConverter implements IStringConverter<DigestAlgorithm> {
//     @Override
//     public DigestAlgorithm convert(String s) {
//         if (!AssertHelper.stringMustBeInList("digest algorithm", s, new String[] {"SHA1", "SHA256", "SHA512"})) {
//             throw new ParameterException(
//                     String.format("Could not recognize %s as a valid digest algorithm.", s));
//         } else if ("SHA1".equalsIgnoreCase(s)) {
//             return DigestAlgorithm.SHA1;
//         } else if ("SHA256".equalsIgnoreCase(s)) {
//             return DigestAlgorithm.SHA256;
//         } else {
//             return DigestAlgorithm.SHA512;
//         }
//     }
// }
// 
// Path: sd-dss-util-cli/src/main/java/it/latraccia/dss/util/cli/argument/converter/PackagingConverter.java
// public class PackagingConverter implements IStringConverter<SignaturePackaging> {
//     @Override
//     public SignaturePackaging convert(String s) {
//         if (!AssertHelper.stringMustBeInList("signature packaging", s, new String[]{"ENVELOPED", "ENVELOPING", "DETACHED"})) {
//             throw new ParameterException(
//                     String.format("Could not recognize %s as a valid signature packaging.", s));
//         } else if ("ENVELOPED".equalsIgnoreCase(s)) {
//             return SignaturePackaging.ENVELOPED;
//         } else if ("ENVELOPING".equalsIgnoreCase(s)) {
//             return SignaturePackaging.ENVELOPING;
//         } else {
//             return SignaturePackaging.DETACHED;
//         }
//     }
// }


import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import eu.europa.ec.markt.dss.DigestAlgorithm;
import eu.europa.ec.markt.dss.signature.SignaturePackaging;
import it.latraccia.dss.util.cli.argument.converter.DigestAlgorithmConverter;
import it.latraccia.dss.util.cli.argument.converter.PackagingConverter;
import java.util.List;
/*
 * SD-DSS-Util, a Utility Library and a Command Line Interface for SD-DSS.
 * Copyright (C) 2013 La Traccia http://www.latraccia.it/en/
 * Developed by Francesco Pontillo
 *
 * This program 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see [http://www.gnu.org/licenses/].
 */

package it.latraccia.dss.util.cli.argument;



@Parameters(separators = "=")
public class SignatureArgs {
    /* MAIN PARAMETERS */
    @Parameter(required = true,
            description = "Source filenames of the files to be signed")
    private List<String> source;

    @Parameter(names = {"-o", "--output"},
            description = "Destination path or file name for the signed document")
    private String output;

    @Parameter(names = {"-u", "--url"},
            description = "URL of the DSS Web Service")
    private String url;

    @Parameter(names = {"-log", "--log"},
               description = "Path for the output log file")
    private String log;
    /* END OF MAIN PARAMETERS */

    /* SIGNATURE FORMAT PARAMETERS */
    @Parameter(names = {"-f", "--format"}, required = true,
            description = "Signature format, depending on the file type can be \"CAdES\", \"XAdES\", \"PAdES\" " +
                    "(for PDF files only), \"ASiC-S\"")
    private String format;

    @Parameter(names = {"-l", "--level"}, required = true,
            description = "Signature level, depending on the format can be \"BES\", \"EPES\", \"LTV\", \"T\", \"C\", " +
                    "\"X\", \"XL\", \"A\"")
    private String level;

    @Parameter(names = {"-p", "--packaging"}, required = true,
            description = "Signature packaging, the way it is related with the content being signed. " +
                    "Can be \"ENVELOPED\", \"ENVELOPING\", \"DETACHED\"",
            converter = PackagingConverter.class)
    private SignaturePackaging packaging;

// Path: sd-dss-util-cli/src/main/java/it/latraccia/dss/util/cli/argument/converter/DigestAlgorithmConverter.java
// public class DigestAlgorithmConverter implements IStringConverter<DigestAlgorithm> {
//     @Override
//     public DigestAlgorithm convert(String s) {
//         if (!AssertHelper.stringMustBeInList("digest algorithm", s, new String[] {"SHA1", "SHA256", "SHA512"})) {
//             throw new ParameterException(
//                     String.format("Could not recognize %s as a valid digest algorithm.", s));
//         } else if ("SHA1".equalsIgnoreCase(s)) {
//             return DigestAlgorithm.SHA1;
//         } else if ("SHA256".equalsIgnoreCase(s)) {
//             return DigestAlgorithm.SHA256;
//         } else {
//             return DigestAlgorithm.SHA512;
//         }
//     }
// }
// 
// Path: sd-dss-util-cli/src/main/java/it/latraccia/dss/util/cli/argument/converter/PackagingConverter.java
// public class PackagingConverter implements IStringConverter<SignaturePackaging> {
//     @Override
//     public SignaturePackaging convert(String s) {
//         if (!AssertHelper.stringMustBeInList("signature packaging", s, new String[]{"ENVELOPED", "ENVELOPING", "DETACHED"})) {
//             throw new ParameterException(
//                     String.format("Could not recognize %s as a valid signature packaging.", s));
//         } else if ("ENVELOPED".equalsIgnoreCase(s)) {
//             return SignaturePackaging.ENVELOPED;
//         } else if ("ENVELOPING".equalsIgnoreCase(s)) {
//             return SignaturePackaging.ENVELOPING;
//         } else {
//             return SignaturePackaging.DETACHED;
//         }
//     }
// }


// Path: sd-dss-util-cli/src/main/java/it/latraccia/dss/util/cli/argument/SignatureArgs.java
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import eu.europa.ec.markt.dss.DigestAlgorithm;
import eu.europa.ec.markt.dss.signature.SignaturePackaging;
import it.latraccia.dss.util.cli.argument.converter.DigestAlgorithmConverter;
import it.latraccia.dss.util.cli.argument.converter.PackagingConverter;
import java.util.List;

/*
 * SD-DSS-Util, a Utility Library and a Command Line Interface for SD-DSS.
 * Copyright (C) 2013 La Traccia http://www.latraccia.it/en/
 * Developed by Francesco Pontillo
 *
 * This program 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 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see [http://www.gnu.org/licenses/].
 */

package it.latraccia.dss.util.cli.argument;



@Parameters(separators = "=")
public class SignatureArgs {
    /* MAIN PARAMETERS */
    @Parameter(required = true,
            description = "Source filenames of the files to be signed")
    private List<String> source;

    @Parameter(names = {"-o", "--output"},
            description = "Destination path or file name for the signed document")
    private String output;

    @Parameter(names = {"-u", "--url"},
            description = "URL of the DSS Web Service")
    private String url;

    @Parameter(names = {"-log", "--log"},
               description = "Path for the output log file")
    private String log;
    /* END OF MAIN PARAMETERS */

    /* SIGNATURE FORMAT PARAMETERS */
    @Parameter(names = {"-f", "--format"}, required = true,
            description = "Signature format, depending on the file type can be \"CAdES\", \"XAdES\", \"PAdES\" " +
                    "(for PDF files only), \"ASiC-S\"")
    private String format;

    @Parameter(names = {"-l", "--level"}, required = true,
            description = "Signature level, depending on the format can be \"BES\", \"EPES\", \"LTV\", \"T\", \"C\", " +
                    "\"X\", \"XL\", \"A\"")
    private String level;

    @Parameter(names = {"-p", "--packaging"}, required = true,
            description = "Signature packaging, the way it is related with the content being signed. " +
                    "Can be \"ENVELOPED\", \"ENVELOPING\", \"DETACHED\"",
            converter = PackagingConverter.class)
    private SignaturePackaging packaging;

    @Parameter(names = {"-d", "--digest-algorithm"}, converter = DigestAlgorithmConverter.class,