const PublishType = require("./PublishType");

class ReserveResultPojo {

    constructor(id, phoneNumber, passportNumber, mail, lastName, firstName, storeType, url, type = PublishType.ERROR) {
        this.id = id;
        this.phoneNumber = phoneNumber;
        this.passportNumber = passportNumber;
        this.firstName = firstName;
        this.lastName = lastName;
        this.storeType = storeType;
        this.url = url;
        this.email = mail;
        this.type = type;
        this.source_from = ""
        this.created_at = new Date().toLocaleString()
    }

    to_mongo_dict() {
        return {
            id: this.id,
            phone: this.phoneNumber,
            firstName: this.firstName,
            lastName: this.lastName,
            email: this.email,
            passport: this.passportNumber,
            url: this.url,
            store_type: this.storeType,
            source_from: this.source_from,
            created_at: this.created_at
        }
    }

    static create_from_contact(contactPojo, id, url, storeType, type) {
        return new ReserveResultPojo(id, contactPojo.phoneNumber, contactPojo.passportNumber, contactPojo.mail, contactPojo.lastName, contactPojo.firstName, storeType, url, type);
    }

}

module.exports = ReserveResultPojo