import datetime
import os.path

lines = []

# --- NUMERIC DICTIONARIES ---

numbers = {
    0: "zero",
    1: "one",
    2: "two",
    3: "three",
    4: "four",
    5: "five",
    6: "six",
    7: "seven",
    8: "eight",
    9: "nine",
    10: "ten",
    11: "eleven",
    12: "twelve",
    13: "thirteen",
    14: "fourteen",
    15: "fifteen",
    16: "sixteen",
    17: "seventeen",
    18: "eighteen",
    19: "nineteen",
    20: "twenty"
}

numbersadj = {
    0: "zeroth",
    1: "first",
    2: "second",
    3: "third",
    4: "fourth",
    5: "fifth",
    6: "sixth",
    7: "seventh",
    8: "eighth",
    9: "ninth",
    10: "tenth",
    11: "eleventh",
    12: "twelfth",
    13: "thirteenth",
    14: "fourteenth",
    15: "fifteenth",
    16: "sixteenth",
    17: "seventeenth",
    18: "eighteenth",
    19: "nineteenth",
    20: "twentieth"
}

# --- WRITING METHODS ---

def writeline (line="", indent=0):
    if line is None: return
    for i in range(indent): line = "\t" + line
    lines.append(line + "\n")

def docline (line="", indent=0):
    if line is None: return
    writeline("/// " + line, indent)

def comline (line="", indent=0):
    if line is None: return
    writeline("// " + line, indent)

def writeheader (outputPath: str, description: str):
    now = datetime.datetime.now()

    comline()
    comline(os.path.basename(outputPath))
    comline(description)
    comline()
    comline(f"This code was autogenerated on {now.strftime('%m/%d/%Y')} at {now.strftime('%H:%M:%S')}.")
    comline(f"Manual changes to this document will not be reflected if/when it is regenerated.")
    comline()
    writeline()

def writeToOutput(file):
    file.writelines(lines)