using ArgParse



function parse_commandline()
    settings = ArgParseSettings(autofix_names=true)

    @add_arg_table settings begin
        "--train"
            nargs = 0
            help = "if given, triggers training phase"
        "--test"
            nargs = 0
            help = "if given, triggers the computation of the loss over the testing set"
        "--learning-rate"
            arg_type = Float64
            default = 1e-3
        "--epochs"
            arg_type = Int64
            default = 500
        "--horizon"
            arg_type = Int64
            default = 12
        "--cell"
            arg_type = String
            default = "ses"
            help = "operator to be used within the actual model. See available cells using `Ses.available_cells`"
        "--frequencies"
            arg_type = String
            default = ""
            help = "if not empty, defines the seasonal pattern(s) to be added to the model"
        "--modes"
            arg_type = String
            default = ""
            help = "if not empty, the string represents the nature of each seasonal pattern defined in `--frequencies`"
        "--delimiter"
            arg_type = String
            default = ":"
            help = "delimiter to split --frequencies and --modes"
        "--model-location"
            arg_type = String
            default = joinpath(@__DIR__, "./Model")
            help = "location where logs are stored"
        "--model-name"
            arg_type = String
            default = "model"
        "--use-bson"
            nargs = 0
            help = "if given, use `BSON` package to store/load the model instead of the `Serialization` [default]"
        "--log"
            nargs = 0
            help = "if given, triggers logs creation. `TensorBoardLogger` is required"
        "--log-location"
            arg_type = String
            default = joinpath(@__DIR__, "./Log")
            help = "location where logs are stored"
        "--log-prefix"
            arg_type = String
            default = ""
            help = "string to prefix logs' name with"
        "--verbose"
            nargs = 0
            help = "if given, additional information will be printed during training"
        "--no-timeit-training"
            nargs = 0
            help = "if given, the timing of the training execution is suppressed"
        "--plot"
            nargs = 0
            help = "if given, can trigger plot blocks in the source script"
        "--fig-location"
            arg_type = String
            default = joinpath(@__DIR__, "./Fig")
        "--fig-name"
            arg_type = String
            default = ""
        "--fig-extension"
            arg_type = String
            default = ".html"
    end
    
    return parse_args(settings, as_symbols = true)

end

get_commandline_defaults() =
    Dict(
        :train  =>  false,
        :test  =>  false,
        :learning_rate  =>  0.001,
        :epochs  =>  500,
        :horizon  =>  12,
        :cell  =>  "ses",
        :frequencies => "",
        :modes => "",
        :delimiter => ":",
        :model_location  =>  joinpath(@__DIR__, "./Model"),
        :model_name  =>  "model",
        :log  =>  false,
        :log_location  =>  joinpath(@__DIR__, "./Log"),
        :log_prefix  =>  "",
        :verbose  =>  false,
        :no_timeit_training  =>  false,
        :plot  =>  false,
        :fig_location => joinpath(@__DIR__, "./Fig"),
        :fig_name => "",
        :fig_extension => ".html"
    )