import { Address } from "./Business";
import { constructDate, filterNumber, } from "../components/business-forms/utils/helpers";
export class Owner {
    constructor(owner) {
        this.address = Object.assign({}, new Address(owner.address || {}));
        this.created_at = owner.created_at;
        this.dob_day = filterNumber(owner.dob_day);
        this.dob_month = filterNumber(owner.dob_month);
        this.dob_year = owner.dob_year;
        this.dob_full =
            constructDate(this.dob_year, this.dob_month, this.dob_day) || '';
        this.documents = owner.documents;
        this.email = owner.email;
        this.id = owner.id;
        this.business_id = owner.business_id;
        this.is_owner = owner.is_owner;
        this.metadata = owner.metadata;
        this.name = owner.name;
        this.phone = owner.phone;
        this.platform_account_id = owner.platform_account_id;
        this.identification_number = owner.identification_number;
        this.ssn_last4 = owner.ssn_last4;
        this.title = owner.title;
        this.ownership_percentage = owner.ownership_percentage;
        this.updated_at = owner.updated_at;
    }
    // Getter method to return the payload in the desired shape
    get payload() {
        return {
            address: new Address(this.address || {}).payload,
            dob_day: this.dob_day || '',
            dob_month: this.dob_month || '',
            dob_year: this.dob_year || '',
            email: this.email || '',
            identification_number: this.identification_number || undefined,
            is_owner: this.is_owner || false,
            metadata: this.metadata || null,
            name: this.name || '',
            phone: this.phone || '',
            platform_account_id: this.platform_account_id || null,
            title: this.title || '',
            ownership_percentage: this.ownership_percentage || undefined,
        };
    }
}
export class Representative {
    constructor(representative) {
        this.address = Object.assign({}, new Address(representative.address || {}));
        this.created_at = representative.created_at;
        this.dob_day = filterNumber(representative.dob_day);
        this.dob_month = filterNumber(representative.dob_month);
        this.dob_year = representative.dob_year;
        this.dob_full =
            constructDate(this.dob_year, this.dob_month, this.dob_day) || '';
        this.documents = representative.documents;
        this.email = representative.email;
        this.id = representative.id;
        this.business_id = representative.business_id;
        this.is_owner = representative.is_owner;
        this.metadata = representative.metadata;
        this.name = representative.name;
        this.phone = representative.phone;
        this.platform_account_id = representative.platform_account_id;
        this.identification_number = representative.identification_number;
        this.ssn_last4 = representative.ssn_last4;
        this.title = representative.title;
        this.ownership_percentage = representative.ownership_percentage;
        this.updated_at = representative.updated_at;
    }
    // Getter method to return the payload in the desired shape
    get payload() {
        return {
            address: new Address(this.address || {}).payload,
            dob_day: this.dob_day || '',
            dob_month: this.dob_month || '',
            dob_year: this.dob_year || '',
            email: this.email || '',
            is_owner: this.is_owner || false,
            identification_number: this.identification_number || undefined,
            metadata: this.metadata || null,
            name: this.name || '',
            phone: this.phone || '',
            platform_account_id: this.platform_account_id || null,
            title: this.title || '',
        };
    }
}
