
from ..configuration import config, dir_map

new_project = {
    'help':"new project help",
    'name':"The name of the new project.",
    'project_dir':"The path to the top level directory for the BJSConvert output.",
    'in_dir':"The path to the directory containing the NLETS raw bar delimited segment files and the spss sample file (required).",
    'metadata_dir': "The path to the directory containing the project metadata files. Default: root_dir/bjs_rules/metadata.",
    'rule_dir':"The path to the directory containing the project rules. Default: root_dir/bjs_rules/rules.",
    'follow_period': "The number of years after the date of release arrest to include in the recidivism database and flat files. Default = 5 years, follow all arrest records up to 5 years after date release.",
    'threads':"The number of threads to use when running the recidivism transform phase. Default: 250",
    'cores':"The number of cores the system has available to use. Default: 4",
    'verbose': "A debug option to set debug logging to verbose. Pass -v to enable. Default: False",
    'host': "Name of database host to connect to. Default: localhost.",
    'port': "TCP port of MySQL server. Default: standard port (3306).",
    'db_stand_name': "Name of standardized database. Default: project name",
    'db_stand_user': "The user to authenticate as. Default: root",
    'db_stand_pass': "The password to authenticate with. Default: pass",
    'db_recid_name': "Name of recidivism database. Default: project name_recid",
    'db_recid_user': "The user to authenticate as. Default: root",
    'db_recid_pass': "The password to authenticate with. Default: pass",
}

add_user = {
    'help': "Add User: Add a user account",
    "verbose": "A debug option to set debug logging to verbose. Pass -v to enable. Default: False",
}

drop_user = {
    'help': "Drop User: Remove a user account from the system",
    "verbose": "A debug option to set debug logging to verbose. Pass -v to enable. Default: False",
}

update_user = {
    'help': "Update User: Update a user account's username and/or password",
    "verbose": "A debug option to set debug logging to verbose. Pass -v to enable. Default: False",
}

activate = {
    'help': "Activate help",
    'name': "The name of the project to activate.",
    'root': "The location of the root directory contianing project data. By default uses the current projects root_dir configuration setting.",
    'verbose': "Enable for verbose output."
}
    
stage = {
  'segments': """The segments to run delimited by '|'
           su = subject, a = arrest, c = court/sentence, s = supervision, d = demographic
           Example) -s a|c will run the arrest and court segments
           Default = su|a|c|s|d""",
    'name':"The name of the project to stage (required).",
    'in_dir': "The input directory for the raw segment files. Default: %s" % config.in_dir,
    'metadata_dir':"The directory containing segment metadata files. Default: %s" % config.meta_dir,
    'username': "The user to authenticate as. Default: %s" % config.db_stand_user,
    'password': "The password to authenticate with. Default: %s" % config.db_stand_pass.replace('%', '%%'),
    'no_db': "Do not rebuild database. Pass this parameter to set to True. Default: False", 
    'verbose': "A debug option to set debug logging to verbose. This will print more logging and raise exceptions that otherwise would have been hidden. Pass -v to enable. Default: %s" % config.debug_verbose,
}

convert = {
    'out_dir': "The output directory for the converted segment files. Default = %s" % config.out_dir,
    'in_dir': "The input directory for the data to be converted. Default = %s" % config.in_dir,
    'metadata_dir': "The directory containing segment metadata files. Default = %s" % config.meta_dir,
    'out_format': "The desired output file format. Default = del",
    'in_format': "The desired input file format. Default = del",
    'in_delimiter': "A delimiter to use for loading delimited files. Default = '|'",
    'out_delimiter': "A delimiter to use for saving delimited files. Default = '|'",
    'original': "Convert the raw input data from NLETS. Default = False",
    'max_width': "The maximum string width for output variables. Default = 1300",
    'verbose': "Verbose option: More details of processing. Default = False",
    'segments': """The segments to run delimited by '|'
           su = subject, a = arrest, c = court/sentence, s = supervision, d = demographic
           Example) -s a|c will run the arrest and court segments
           Default = su|a|c|s|d""",
}

pre_process = {
    'limit': "Set a load limit. Default = None",
    'verbose': "Verbose option: More details of processing. Default = False",
    'segments': "The segments to run. Default = 'a|c|s|d'",
    'username': "The user to authenticate as. Default: %s" % config.db_stand_user,
    'password': "The password to authenticate with. Default: %s" % config.db_stand_pass.replace('%', '%%'),
    'cores': "The number of cores available on the machine. This number determines how many subporcesses are spawned. Default = %s" % config.cores,            
}

process = {
    'segments': """The segments to run delimited by '|'
                   a = arrest, c = court/sentence, s = supervision, d = demographic
                   Example) -s a|c will run the arrest and court segments
                   Default = a|c|s|d""",
    'out_dir': "The output directory to save the processed segment files. Default = %s" % config.out_dir,
    'metadata_dir': "The directory containing segment metadata files. Default = %s" % config.meta_dir,
    'rules': "The root directory of the processing rules. Default = %s" % dir_map['process_rules_dir'],
    'out_format': "The file format for saving the processed files, Default = spss.",
    'limit': "Set a load limit. Default = None",
    'verbose': "Verbose option: More details of processing. Default = False",
    'where': "SQL where clause applied on data loading. Default = None",
    'regions': "A region to load. Pass this arguement multiple times to load multiple regions. example) -r az -r mn",
    'cores': "The number of cores available on the machine. This number determines how many subprocesses are spawned. Default = %s" % config.cores,
    'include_rules': "Pass this parameter one or multiple times to only include a specific rules for process phase. Default=[]",
    'exclude_rules': "Pass this parameter one or multiple times to exclude specific rules from process phase. Default=[]" 
}

transform = {
    'out_dir': "The output directory to save the transformed segment files. Default = %s" % config.out_dir,
    'metadata_dir': "The directory containing segment metadata files. Default = %s"% config.meta_dir,
    'cores': "The number of cores available on the machine. This number determines how many subprocesses are spawned. Default = %s" % config.cores,
    'thread': "The number of threads to use on a given subprocess. Default = %s" % config.transform_threads,
    'verbose': "Verbose option: More details of processing. Default = False",
    'juv_flag': "Pass this parameter to turn on flagging of juvenile records. Default = False",
    'offense_deletion_flags': "Pass this parameter zero or more times to flag offenses for removal from the recidivism database. By default traffic offenses are flagged offense code of 550.",
    'follow_period': "Set number of years for follow-up window. Default = %i" % config.follow_period,      
}

cleanup = {
    'help': "Cleanup help. Run cleanup to remove out_dir.process and tmp dir files. ",
    'verbose': "Verbose option: More details of file deletion. Default = False",
}

load_recid_db = {
    'in_dir': "The output directory to save the transformed segment files. Default = %s""" % config.tmp_out_dir,
    'out_format': "Set to spss if you want to output spss files in addition to creating the database. Default = mysql",
    'metadata_dir': "The directory containing segment metadata files. Default = %s"% config.meta_dir,
    'verbose': "Verbose option: More details of recidivism transformations. Enable this option to output the set of records that were removed from the recidivism dataset. Default = False"
}

load_recid_flat = {
    'out_dir': "The output directory to save the transformed segment files. Default = %s""" % config.out_dir,
    'cores': "The number of cores available on the machine. This number determines how many subporcesses are spawned. Default = %s" % config.cores,
    'thread': "The number of threads to use on a given subprocess. Default = %s" % config.transform_threads,
    'verbose': "Verbose option: More details of processing. Default = False",
    'follow_period': "Set number of years for follow-up window. Default = %i" % config.follow_period,
}

compare = {
    'out_dir': "The directory to output the log files to. Default = %s" % config.log_dir,
    'verbose': "Verbose option: output differences to command line. Default = False",
    'segments': 'The name of the segments to compare. Supports bar delimited list of segments: For arrest and court use "a|c". For summary comparison use "summary".',
    'region': 'The name of the region to compare.  Default = all',
    'set': 'The name of the set to be used in the comparison. Default = %s' % str(config.current_set),
    'round': 'The round you want to compare to the current round.  Specify an integer of the round you want.  Default = %i (Previous round)' % (-1)
}

compare_stable = {
    'segments': "The segments to run.",
    'max_thread': "The maximum number of current threads to run. Default = 100",
    'set': "The set to run the compare on.  Default = %s" % str(config.current_set)
}

predict = {
    'sample': "Specifiy the percentage of random sample to use when creating training and testing data. Default = 1 (full sample).",
    'verbose': "Set the level of output messages. 0 = None, 1 = errors, 2 = warnings"
}

datadump_sub = {
    'segments': "The segments to run.  Default = 'a|c'",
    'delimiter': " The delimiter to use. Default = '|'",
    'in_dir': "The directory containing the processed region files. Default = %s" % config.out_dir
}

validate = {
    'metadata_dir': "The directory containing segment metadata files. Default = %s" % config.meta_dir,
    'rules': "The root directory of the processing rules. Default = %s" % dir_map['process_rules_dir'],
    'halt_on_error': "If set to True then the program will stop running when it encounters an error in running the processing rules. Default = False.",
    'verbose': "Verbose option: More details of processing. Default = False"            
}

report = {
    'log_dir': "The directory for the log files to run reports on. Default = %s" % config.log_dir,
    'report_dir': "The directory where the reports should be saved to. Default = %s" % config.report_dir,
    'verbose': "Verbose option: More details of run reports. Default = False"          
}

test = {
    'verbosity': "Level of verbosity. Default = 2"
}

update_metadata = {
    'verbose': "Enable for pretty json output. Default = False"
}

load_rules = {
    'region': "A region to load. Pass this arguement multiple times to load multiple regions. example) -r az -r mn",
    'all_regions': "Load all the regions.",
    'no_replace': "Add this parameter if you are sure that all your key columns are text. This will not replace the .0 excel adds to integer values on the key columns. Default = False",
    'wvfbi': "Toggle to load wvfbi global rules. Default = False",
    'verbose': "Verbose log output. Default = False",
    'sentence': "Only reload the sentence crosswalk.  Default = False",
    'offense': "Only reload the offense crosswalk.  Default = False"
}

copy_rules = {
    'src_project': 'The name of the project you wish to copy rules from. Uses the current root_dir configuration setting to find the project. This arguement will override src if both are supplied.',
    'src': 'The path to the project you want to copy the rules from. example) YOUR_PATH\project_data\rel2005',
    'dst_project': 'The name of the project you wish to copy the rules to. By default this is None and the rules will be copied to the build/rules folder in the source code. If this arguement is specified will use the root_dir configuration setting to locate the project folder. This arguement will override dst if both are supplied.',
    'dst': 'The folder path to the project which the rules will be copied to. example) YOUR_PATH\project_data\juvenile_offenders',
    'verbose': 'Verbose error and log output. Default = False.',
}