#Using a class to create sections of Q & A interaction with caller/reporter
#lang = "f"
lang = ""
def language():
    global lang
    lang = input("language? f or e : ")
    #return lang
    print("language = " + str(lang))
language()

#Default values
agent = "Luc T."
reftik = "IR03899999"
#Default values Service Request
srD = ""
who4l = ""
who4f = ""
who4d = ""
who4t = ""
who4e = ""
who4id = ""
#Default values Incident
inD = ""
out = ""
s = ""
nua = ""
asac = ""
ioos = ""
bi = ""
err = ""
#Default TC
tcuid = ""
tci = ""
#Default values Reporter
rl = ""
rf = ""
rt = ""
rd = ""
re = ""
peo = ""
#Default values End User
eud = ""
eul = ""
euf = ""
eut = ""
euid = ""
eue = ""


class Esd:
    def fork(self):
        global lang, inD
        pfork = ''
        while pfork != "os" and "c4"  and "r" and "eu" and "qi" and "dr" and "deu" and "dsr" and "din" and "da" and "cs" and "end" and "4tc" and "az" and "telus" and "bell" and "4pw" and "4bb" and "4sr" and "4in" and "4up"  and "dtci" and "prompt" and "lang":
            if lang == "f":
                pfork = input("\nAgent: quelle tâche?: ")
            else:
                pfork = input("\nAgent: which task?: ")
            if pfork == "os":
                e.openScript()
                e.fork()
            elif pfork == "c4":
                e.callType()
                e.fork()
            elif pfork == "r":
                e.reporterQuestions()
                e.fork()
            elif pfork == "4sr":
                e.serviceRequestQuestions()
                e.fork()
            elif pfork == "4in":
                e.incidentQuestions()
                e.fork()
            elif pfork == "4up":
                e.call4Update()
                e.fork()
            elif pfork == "4pw":
                e.call4PW()
                e.fork()
            elif pfork == "4bb":
                e.call4BB()
                e.fork()
            elif pfork == "4tc":
                e.tcReporterQuestions()
            elif pfork == "az":
                e.callFromAllstreamZayo()
                e.fork()
            elif pfork == "telus":
                e.callFromTelus()
                e.fork()
            elif pfork == "bell":
                e.callFromBell()
                e.fork()
            elif pfork == "eu":
                e.endUserQuestions()
                e.fork()
            elif pfork == "qi":
                e.incidentQuestions()
                e.fork()
            elif pfork == "dr":
                e.displayReporter()
                e.fork()
            elif pfork == "dtci":
                e.displayTci()
                e.fork()
            elif pfork == "deu":
                e.displayEndUser()
                e.fork()
            elif pfork == "dsr":
                e.displayReporter()
                e.displayServiceRequest()
                e.fork()
            elif pfork == "din":
                e.displayIncident()
                e.fork()
            elif pfork == "da":
                e.displayAll()
                e.fork()
            elif pfork == "cs":
                e.closeScript()
                e.fork()
            elif pfork == "prompt":
                prompt()
            elif pfork == "end":
                e.stop()
            elif pfork == "cl":
                language()

    def openScript(self):
        global lang, rl, rf, rt, rd, re, peo, t
        if lang == "f":
            print("Bonjour, Merci d'appeler le Bureau de Soutien Technique (d'Entreprise).\nMon nom est " + str(agent) + "\nPuis-je commencer avec votre Nom (de famille) svp?\n")
            e.rQs()

        else:
            print("Hi, Thank you for calling the (Enterprise) Service Desk.\nMy name is " + str(agent) + ".\nMay I start with your last name please?\n")
            e.rQs()

    def closeScript(self):
        global lang, rl, rf, rt, rd, re, peo, t
        if lang == "f":
            print ("\nVotre billet de référence est " + str(reftik) + ".")

            print ("\nEst-ce qu'il y a autre chose avec laquelle je puisse vous aider aujourd'hui?")

            print ("\nMerci d'avoir appelé le Bureau de Soutien Technique d'Entreprise")
            e.fork()

        else:
            print ("\nYour reference number for this call is " + str(reftik) + ".")

            print ("\nIs there anything else that I may assist you with today?")

            print ("\nThank you for calling the Servide Desk")
            e.fork()

    def reporterQuestions(self):
        global lang, rl, rf, rt, rd, re, peo, t, call4
        if lang == "f":
            rl = input("Nom (Famille)?: ")
            if rl == "quit":
                e.fork()
        else:
            rl = input("Last Name?: ")
            if rl == "quit":
                e.fork()

        if lang == "f":
            rf = input("Prénom?: ")
        else:
            rf = input("What is your First Name?: ")


        if lang == "f":
            rt = input("Un numéro de téléphone pour vous joindre?: ")
        else:
            rt = input("Phone number to reach you at?: ")


        if lang == "f":
            rd = input("Quel est votre ministère?: ")
        else:
            rd = input("What is your department?: ")

        if lang == "f":
            re = input("Un courriel pour vous joindre?: ")
        else:
            re = input("Email to reach you at?: ")

        if lang == "f":
            peo = input("Appelez-vous d'un bureau de soutien technique (PSD or EU ou Autre?): ")
        else:
            peo = input("Are you calling from a SD? (PSD or EU or Other?): ")

        if lang == "f":
            t = input("Avez-vous un numéro de référence?: ")
        else:
            t = input("Do you have a reference ticket number?: ")

    def tcReporterQuestions(self):
        global lang, rl, rf, rt, tcuid, tci, rd, re, peo
        if lang == "f":
            rl = input("Nom (Famille)?: ")
            if rl == "quit":
                e.fork()
        else:
            rl = input("Last Name?: ")
            if rl == "quit":
                e.fork()

        if lang == "f":
            rf = input("Prénom?: ")
        else:
            rf = input("What is your First Name?: ")


        if lang == "f":
            rt = input("Un numéro de téléphone pour vous joindre?: ")
        else:
            rt = input("Phone number to reach you at?: ")

        if lang == "f":
            tcuid = input("Nom d'utilisateur TC?:")
        else:
            tcuid = input("TC user ID?: ")

        if lang == "f":
            tci = input("Comment pouvons-nous vous aider?: ")
        else:
            tci = input("How may we help you?: ")
        rd = "TC"
        re = (rf + rl + "@tc.gc.ca")
        #re = ""
        peo = "EU"

        e.displayTci()

    def endUserQuestions(self):
        global lang, eud, eul, euf, eut, euid, eue

        if lang == ("f"):
            #ref de l'utilisation du terme 'utilisateur affecté' :  https://www.usherbrooke.ca/immeubles/fileadmin/sites/immeubles/documents/entretien/Capsule_d_information_utilisateur_affecte.pdf
            eud = input("Quel est le Ministère de l'utilisateur affecté?: ")
            if eud == "quit":
                e.fork()
        else:
            eud = input("What is the End User's department?: ")
            if eud == "quit":
                e.fork()

        if lang == ("f"):
            eul = input("Nom de l'utilisateur affecté?: ")
        else:
            eul = input("End User's Last Name?: ")

        if lang == ("f"):
            euf = input("Prénom de l'utilisateur affecté?: ")
        else:
            euf = input("End User's First Name?: ")

        if lang == ("f"):
            euid = input("Identifiant (ID) de l'utilisateur affecté?: ")
        else:
            euid = input("End User ID?: ")

        if lang == ("f"):
            eut = input("Meilleur numéro de téléphone pour rejoindre l'utilisateur affecté?: ")
        else:
            eut = input("Best phone number to reach the End User: ")

        if lang == ("f"):
            eue = input("Adresse courriel pour rejoindre l'utilisateur affecté?: ")
        else:
            eue = input("Email to reach End User?: ")

    def incidentQuestions(self):
        global lang, rl, rf, rt, rd, re, peo, t, inD, out, s, nua, asac, ioos, bi, err
        e.reporterQuestions()
        print("\n")
        if lang == ("f"):
            inD = input("Description de l'Incident: ")
            out = input("Y-a-t-il une panne? (oui ou non): ")
            if out == "quit":
                e.fork()
        else:
            inD = input("Incident Description: ")
            out = input("Is there an outage? (yes or no): ")
            if out == "quit":
                e.fork()


        if lang == ("f"):
            s = input("Quel est l'étendue de la panne ou de l'incident?: ")
        else:
            s = input("What is the scope of the outage/incident?: ")

        if lang == ("f"):
            nua = input("Combien d'utilisateurs affectés?: ")
        else:
            nua = input("How many users affected?: ")


        if lang == ("f"):
            asac = input("Quel système-application-ci affecté?: ")
        else:
            asac = input("Which affected system-application-ci?: ")


        if lang == ("f"):
            ioos = input("Quel impact sur les autres systèmes?: ")
        else:
            ioos = input("What impact,if any, on other systems?: ")


        if lang == ("f"):
            bi = input("Quel impact sur les affaires?: ")
        else:
            bi = input("What is the business impact?: ")

        if lang == ("f"):
            err = input("Quel est le message d'erreur?: ")
        else:
            err = input("What does the error message say?: ")
        print("\n")
        e.endUserQuestions()
        e.fork()

    def serviceRequestQuestions(self):
        global lang, srD, who4l, who4f, who4d, who4t, who4e, who4id
        if lang == ("f"):
            srD = input("Veuillez expliquer la nature de la demande de Service (SR): ")
            print("\ndéfinition: >>>Récipiendaire de service<<<Celui ou celle qui reçoit le service demandé\n")
            who4l = input("Nom (famille) du Récipiendaire de service?: ")
            who4f = input("Prénom du Récipiendaire de service?: ")
            who4d = input("Ministère du Récipiendaire de service?: ")
            who4t = input("Numéro de téléphone du Récipiendaire de service?: ")
            who4e = input("Adresse courriel du Récipiendaire de service?: ")
            who4id = input("Identifiant (ID) du Récipiendaire de service?: ")

        else:
            srD = input("Please describe what is the Service Request: ")
            print("\ndefinition: >>>Service recipient<<<Person for which the service is requested\n")
            who4l = input("(Last) NAME of the Service recipient?: ")
            who4f = input("(First) name of the Service recipient?: ")
            who4d = input("Department of the Service recipient?: ")
            who4t = input("Telephone number to reach the Service recipient?: ")
            who4e = input("Email address to reach the Service recipient?: ")
            who4id = input("User ID of the Service recipient?: ")

    def call4Update(self):
        global lang, t, chktik, rl, rf, rt, rd, re
        e.reporterQuestions()
        if lang == ("f"):
            if t != "":
                print("Veuillez patienter quelques moments pendant que je recherche le billet " + str(t) + ".")
            else:
                chktik = input("Quel billet souhaitez-vous vérifier?: ")
                print("Veuillez patienter quelques moments pendant que je recherche le billet " + str(chktik) + ".")
        else:
            if t != "":
                print("Please wait for me for a few moments while I pull up ticket " + str(t) + ".")
            else:
                chktik = input("Which ticket should I lookup for you?")
                print("Please wait for me for a few moments while I pull up ticket " + str(chktik) + ".")

    def call4PW(self):
        e.reporterQuestions()
        e.endUserQuestions()
        global lang, euid, pwuid
        if lang == ("f"):
            pwuid = input("User ID?: ")
            print("Voici les commandes pour Infoweb")
            print("TSS LIS(" + str(pwuid) + ") DATA(a)")
            print("TSS REM(" + str(pwuid) + ") SUS")
            print("TSS REP(" + str(pwuid) + ") PASS(canada1,,exp)")
        else:
            pwuid = input("User ID?: ")
            print("Here are the commands for Infoweb")
            print("TSS LIS(" + str(pwuid) + ") DATA(a)")
            print("TSS REM(" + str(pwuid) + ") SUS")
            print("TSS REP(" + str(pwuid) + ") PASS(canada1,,exp)")

    def call4BB(self):
        e.reporterQuestions()
        e.endUserQuestions()
        global lang
        if lang == ("f"):
            print("\npour Blackberry ou autre Mobile")

        else:
            print("\nfor a Blackberry or other Mobile device")


    def call4TC(self):
        global lang, rd
        e.tcReporterQuestions()
        rd = "TC"

    def callFromAllstreamZayo(self):
        global lang
        print("Allstream Zayo Advising ESD")

    def callFromTelus(self):
        global lang
        print("Telus Advising ESD")

    def callFromBell(self):
        global lang
        print("Bell Advising ESD")

    def callType(self):
        global lang
        if lang == ("f"):
            call4 = ""
            while call4 != "4sr" and "4in"  and "4up" and "4pw" and "4tc" and "prompt":
                call4 = input("Quel type d'assistance est requise par la personne au téléphone?: \npassword==> 4pw\nNouvelle Demande SR==> 4sr\nRapporter un Incident==> 4in\nMise-à-jour==> 4u\nTC-Assist==> 4tc\n>>>")
                if call4 == "4sr":
                    e.serviceRequestQuestions()
                    e.fork()
                elif call4 == "4in":
                    e.incidentQuestions()
                    e.fork()
                elif call4 == "4up":
                    e.call4Update()
                    e.fork()
                elif call4 == "4pw":
                    e.call4PW()
                    e.fork()
                elif call4 == "4bb":
                    e.call4BB()
                    e.fork()
                elif call4 == "4tc":
                    e.call4TC()
                    e.fork()
                elif call4 == "az":
                    e.callFromAllstreamZayo()
                    e.fork()
                elif call4 == "telus":
                    e.callFromTelus()
                    e.fork()
                elif call4 == "bell":
                    e.callFromBell()
                    e.fork()
                elif call4 == "prompt":
                    e.fork()
        else:
            call4 = ""
            while call4 != "4sr" and "4in"  and "4up" and "4pw" and "4tc" and "prompt":
                call4 = input("What type of help is required by the Caller?: \nPassword reset? ==> 4pw\nOpening a New Service Request? ==> 4sr\nReporting an Incident? ==> 4in\nCaller wants an Update==> 4u\nTC-Assist caller==> 4tc\n>>>")
                if call4 == "4sr":
                    e.serviceRequestQuestions()
                    e.fork()
                elif call4 == "4in":
                    e.incidentQuestions()
                    e.fork()
                elif call4 == "4up":
                    e.call4Update()
                    e.fork()
                elif call4 == "4pw":
                    e.call4PW()
                    e.fork()
                elif call4 == "4tc":
                    e.call4TC()
                    e.fork()
                elif call4 == "prompt":
                    e.fork()

    def displayReporter(self):
        global lang, rl, rf, rt, rd, re, peo, t
        if lang == ("f"):
            print("\nNom de la personne qui nous avise: " + str(rl))
            print("Prénom de la personne qui nous avise: " + str(rf))
            print("Numéro pour rejoindre par téléphone la personne qui nous avise: " + str(rt))
            print("Ministère de la personne qui nous avise: " + str(rd))
            print("Adresse courriel pour rejoindre la personne qui nous avise: " + str(re))
            print("La personne qui nous avise est un PSD?: " + str(peo))
        else:
            print("\nReporter (caller) Last Name: " + str(rl))
            print("Reporter (caller) First Name: " + str(rf))
            print("Telephone to be able to reach the Reporter (caller): " + str(rt))
            print("Reporter's (caller's) Department: " + str(rd))
            print("Reporter's (caller's) email address: " + str(re))
            print("Is Caller from a PSD?: " + str(peo))

    def displayEndUser(self):
        global lang, eud, eul, euf, eut, euid, eue
        if lang == ("f"):
            print("Ministère de l'utilisateur affecté: " + eud)
            print("Nom de l'utilisateur affecté: " + eul)
            print("Prénom de l'utilisateur affecté: " + euf)
            print("Identifiant (ID) de l'utilisateur affecté: " + euid)
            print("Meilleur numéro de téléphone pour rejoindre l'utilisateur affecté: " + eut)
            print("Adresse courriel pour rejoindre l'utilisateur affecté: " + eue)
        else:
            print("Affected End User Department: " + eud)
            print("Affected End User Last Name: " + eul)
            print("Affected End User First Name: " + euf)
            print("Affected End User ID: " + euid)
            print("Affected End User Telephone: " + eut)
            print("Affected End User Email: " + eue)

    def displayIncident(self):
        global lang, inD, out, s, nua, asac, ioos, bi, err
        if lang == ("f"):
            print("\nDescription de l'Incident: " + str(inD) + "\n")
            print("\nIl y a une panne: " + str(out))
            print("Étendue de la panne/incident: " + str(s))
            print("Nombre d'utilisateurs affectés: " + str(nua))
            print("System ou CI affecté: " + str(asac))
            print("Impact sur d'autres systèmes: " + str(ioos))
            print("Impact sur les affaires: " + str(bi))
            print("Message d'erreur: " + str(err))
        else:
            print("\nIncident Description: " + str(inD) + "\n")
            print("\nIs this an outage: " + str(out))
            print("What is the scope of the outage: " + str(s))
            print("Number of users affected: " + str(nua))
            print("This is affected: " + str(asac))
            print("Impact on other systems: " + str(ioos))
            print("Business impact: " + str(bi))
            print("Error message: " + str(err))
        print("\n")

    def displayServiceRequest(self):
        global lang, srD, who4l, who4f, who4d, who4t, who4e, who4id
        if lang == ("f"):
            print("\n\nDescription de la demande de Service: " + str(srD) + "\n")
            print("\ndéfinition: >>>Récipiendaire de service<<<Celui ou celle qui reçoit le service demandé\n")
            print("Nom (famille) du Récipiendaire de service - ?: " + str(who4l))
            print("Prénom du Récipiendaire de service?: " + str(who4f))
            print("Ministère du Récipiendaire de service?: " + str(who4d))
            print("Numéro de téléphone du Récipiendaire de service?: " + str(who4t))
            print("Adresse courriel du Récipiendaire de service?: " + str(who4e))
            print("Identifiant (ID) du Récipiendaire de service?: " + str(who4id))

        else:
            print("\n\nService Request description: " + str(srD) + "\n")
            print("\ndefinition: >>>Service recipient<<<Person for which the service is requested\n")
            print("(Last) NAME of the Service recipient?: " + str(who4l))
            print("(First) name of the Service recipient?: " + str(who4f))
            print("Department of the Service recipient?: " + str(who4d))
            print("Telephone number to reach the Service recipient?: " + str(who4t))
            print("Email address to reach the Service recipient?: " + str(who4e))
            print("User ID of the Service recipient?: " + str(who4id))

    def displayIRinfoweb(self):
        global lang
        if lang == ("f"):
            print()
        else:
            print()

    def displayTci(self):
        global lang, rl, rf, rt, tcuid, tci, rd
        if lang == ("f"):
            print("\nNom du rapporteur: " + str(rl))
            print("Prénom du rapporteur: " + str(rf))
            print("Numéro pour rejoindre par téléphone le rapporteur: " + str(rt))
            print("Identifiant de d'utilisateur TC?: " + str(tcuid))
            print("\nDescription du problème/demande?: " + str(tci))
            e.fork()
        else:
            print("\nReporter (caller) Last Name: " + str(rl))
            print("Reporter (caller) First Name: " + str(rf))
            print("Telephone to be able to reach the Reporter (caller): " + str(rt))
            print("Identifiant de d'utilisateur TC?: " + str(tcuid))
            print("\nDescription of problem/request?: " + str(tci))
            e.fork()

    def displayAll(self):
        global lang, srD, inD
        print("\n")
        if srD != "":
            print("Printing feedback: Service Request exists!")
            e.displayReporter()
            print("\n")
            e.displayServiceRequest()

        if inD != "":
            e.displayReporter()
            print("\n")
            e.displayIncident()
            print("\n")
            e.displayEndUser()

        else:
            e.displayReporter()
            print("\n")
            e.displayEndUser()


    def stop(self):
        global lang
        if lang == ("f"):
            print("Allez, on prend une petite pause?")
        else:
            print("Ok, let's take a break, shall we?")

#we are creating a variable which calls the 'class Esd'
e = Esd()
####

####
def prompt():
    p = ""
    while p != "esd" and "other":
        p = input("ESD? ")
        if p == "y":
            e.fork()
####
#we are instanciating the method 'rQs' from within the class
e.fork()
fork = e.fork()
prompt()
