#!/usr/bin/python3
#======================================================================================
# The user program (class) - using the getter and setters
#======================================================================================
import sys                                              
sys.path.insert(0,'/home/s/sultans/web/python/demo/oo/employee2')
from Employee import Employee

class EmployeeUse:

    print("Content-type: text/html \n")             #required HTTP response header

#   co    = Employee.__companyName                  #I can no longer do this
#   count = Employee.__employeeCount

    co    = Employee.getCompanyName()               #I must call the getter method
    count = Employee.getEmployeeCount() 

    Employee.companyInfo()

    e1 = Employee("Dir","Sultan","Sam","M",45)      #instantiate/create objects
    e2 = Employee("Mgr","Smith","Mary","F",35)  
    e3 = Employee("Sec","Stevens","Bob","M",28)
    x  = Employee("???","Person","Mystery","",0)

#   fname = e1.__firstname                          #I can no longer do this
    fname = e1.getFirstname()                       #I must call the getter method
    print("First Name: " + fname)                   #prints  First Name: Sam

#   x.__firstname = "Harry"                         #I can no longer do this
#   x.__lastname  = "Potter"
    x.setFirstname("Harry")                         #I must call the setter method
    x.setLastname("Potter")

    print("After change: " + x.getFirstname() +" "+ x.getLastname())     #replaced with getter methods


    count = Employee.getEmployeeCount( )           #call static method
    print("Number of employees: ", count)          #prints  Number Employees: 4

    name1 = e1.getFullname("Mr.")                  #call instance method 
    print(name1)                                   #prints:  Mr. Sam Sultan

    print(e2.getFullname("Ms."))                   #combining 2 previous. lines

    print( e3.__str__() )                          #call the __str__() method

    print(x)                                       #when an obj. is used in string context
                                                   #no need to say  .__str__( )
                                               
#   Employee.__employeeCount += 10                 #I can no longer do this
                                                   #there is no setter method for employeeCount
                                               
                                               
                                               
                                               
#=== link to see the python code =================================================
import os, sys
sys.path.insert(0,'/home/s/sultans/web/python/demo')
import zCode                          #import func to display the Python code
filename = os.path.abspath(__file__)  #get absolute file name 
zCode.display(filename)               #call it
#=================================================================================