import { Login, User } from './interface';
// import * as UserLogin from './interface';

interface Address {
    street: string;
    city: string;
    state: string;
    pin: string;
}
//implements là để thực hiện các phương thức và thuộc tính của interface
class Employee implements Login {
    #id: number;
    protected name: string;
    address: Address;

    get empId(): number {
        return this.#id;
    }

    set empId(id: number) {
        this.#id = id;
    }

    static getEmployeeCount(): number {
        return 50;
    }
    constructor(id: number, name: string, address: Address) {
        this.#id = id;
        this.name = name;
        this.address = address;
    }
    login(): User {
        return {name: "John Doe", id: 1, email: ""};
    }

    getNameWithAddress(): string {
        return `${this.name} lives at ${this.address}.`;
    }
}

let john = new Employee(1, "John Doe", { "street": "123 Main St", "city": "Anytown", "state": "CA", "pin": "12345" });
// Employee.getEmployeeCount(); // Static method call
john.empId = 100;
console.log(john.empId);
class Manager extends Employee {
    constructor(id: number, name: string, address: Address) {
        super(id, name, address);
    }

    getNameWithAddress(): string {
        return `Manager ${this.name} lives at ${this.address}.`;
    }
}

let address = john.getNameWithAddress();
let mike = new Manager(2, "Mike Smith", { "street": "456 Elm St", "city": "Othertown", "state": "NY", "pin": "67890" });

// john.id = 1;
// john.name = "John Doe";
// john.address = "123 Main St";
console.log(john);
console.log(address);
console.log(mike.getNameWithAddress());