"""

PLEASE READ:

This is the config file for the program.
The file is written in python to make it easy for the program to read it,
however this means you must follow the formatting in the file.
For example, if the value is enclosed in quotation marks, it needs to stay that
way.
Additionally, do not edit anything past the DO NOT EDIT comment.
Everything past there contains code which allows the program to retrieve
this information.
"""

#-----WINDOW GEOMETRY SETTINGS-----

#Width and Height in pixels
WindowWidth = 1000
WindowHeight = 700

#Determines whether or not the windows can be resized. 
AllowResizing = True


#-----DATABASE SETTINGS-----

#Visitor Card Database File Name
#The file extension will be automatically added
DBFileName = "data"

#-----LOGGING SETTINGS-----

#Determines the folder name log files are sent to.
loggingDir = "logs"

#If true, the program will use a different drive to save log files.
#NOTE: You MUST set this to true if using a different drive!
useDDrive = False

#If true, the program will periodically delete log files older than a certain
#age specified by logPurgePeriod.
doLogPurge = False

#Age in days for log files to be purged. For example, if you put in 7, log
#files older than 7 days will be removed on startup. However, in order to do
#this, doLogPurge must be set to True. If it is not, this will be ignored.
logPurgePeriod = 30


#-----OTHER SETTINGS-----
#Allows operators to issue visitor passes despite a patron being banned
overrideBans = False

#Determines whether or not the SAM message is displayed.
dispSAM = False

# Determines which characters are acceptable in the name fields
#---IMPORTANT!---
#Remember that as this config file is written in python, rules for characters
#which need to be escaped MUST BE FOLLOWED.
allowedNameChars = ["'", "-", " "]

#Determines which characters are acceptable in the location/municipality
#fields.
#---IMPORTANT!---
#Remember that as this config file is written in python, rules for characters
#which need to be escaped MUST BE FOLLOWED.
allowedMuniChars = ["'", "-", " "]

#Determines which states or regions appear in the drop down list for the
#state field.
#The states will appear on the list in the order they are entered in here.
#The very first one will be the default state.
states = ['MICHIGAN', 'ALABAMA', 'ALASKA', 'ARIZONA', 'ARKANSAS', 'CALIFORNIA',
          'COLORADO', 'CONNECTICUT', 'DELAWARE', 'FLORIDA', 'GEORGIA', 'HAWAII',
          'IDAHO', 'ILLINOIS', 'INDIANA', 'IOWA', 'KANSAS', 'KENTUCKY',
          'LOUISIANA', 'MAINE', 'MARYLAND', 'MASSACHUSETTS', 'MINNESOTA',
          'MISSISSIPPI', 'MISSOURI', 'MONTANA', 'NEBRASKA', 'NEVADA',
          'NEW HAMPSHIRE', 'NEW JERSEY', 'NEW MEXICO', 'NEW YORK',
          'NORTH CAROLINA', 'NORTH DAKOTA', 'OHIO', 'OKLAHOMA', 'OREGON',
          'PENNSYLVANIA', 'RHODE ISLAND', 'SOUTH CAROLINA', 'SOUTH DAKOTA',
          'TENNESSEE', 'TEXAS', 'UTAH', 'VERMONT', 'VIRGINIA', 'WASHINGTON',
          'WEST VIRGINIA', 'WISCONSIN', 'WYOMING', 'AMERICAN SAMOA',
          'DISTRICT OF COLUMBIA', 'GUAM', 'NORTHERN MARIANA ISLANDS',
          'PUERTO RICO', 'VIRGIN ISLANDS', 'OTHER']

#Determines how the database will be sorted when the program is launched.
#Defaults to 'id'
#'id' = by ID number
#'last' = by last name
#'first' = by first name
#'middle' = by middle name
#'muni' = by municipality
#'state' = by state
#'cards' = by number of cards issued
#'status' = by status
defaultsort = 'last'

#Determines the order by which the default sort is sorted.
#Defaults to 'up'
#'up' = ascending
#'down' = descending
defaultsortorder = 'up'

#Determines the period within visitor cards can be issued.
#Essentially, if the period is set to 10 days and
#a patron gets a visitor card on 11-1-2015, 11-2-2015, and 11-3-2015,
#then they may not get another visitor card until 11-11-2015 at the earliest.
#Even then, that patron can only get 1 visitor card on that day. They'll have
#to wait a day to get 2, and another day to get three.
#The value is a positive integer, and is in days.
VisitorCardPeriod = 365

#The number of visitor cards per VisitorCardPeriod that a patron can get.
#This should be a positive whole number integer which is not zero.
CardsPerPeriod = 3

#If it is set, determines which municipality(s) the visitor card period above
#will apply to. The value is ALWAYS an array of strings, even if there is only
#one municipality. If you set it to a blank array [] then the period will apply to all
#patrons. Additionally, the municipalities must ALWAYS be in all caps.
PeriodDependentMunis = ['NORTHVILLE']

#If set to True, the program will check for duplicate records when adding or
#editing existing records. If it finds an existing record which matches,
#it will not allow you to add the new one.
EnforceNoDuplicates = True


#----------DO NOT EDIT PAST THIS LINE----------#


class Config():
    def __init__(self):
        self.geo = str(WindowWidth) + 'x' + str(WindowHeight)
        self.lockgeo = AllowResizing
        self.dbfn = DBFileName + ".db"
        self.overrideBans = overrideBans
        self.dispSAM = dispSAM
        self.allowedNameChars = allowedNameChars
        self.allowedMuniChars = allowedMuniChars
        self.states = states
        self.defaultsort = defaultsort
        self.defaultsortorder = defaultsortorder
        self.visitorcardperiod = VisitorCardPeriod
        self.loggingDir = loggingDir + "/"
        self.useDDrive = useDDrive
        self.doLogPurge = doLogPurge
        self.logPurgePeriod = logPurgePeriod
        self.PeriodDependentMunis = PeriodDependentMunis
        self.CardsPerPeriod = CardsPerPeriod
        self.EnforceNoDuplicates = EnforceNoDuplicates
