package com.bcxin.tenant.domain.events;

import com.bcxin.Infrastructures.enums.OccupationType;
import com.bcxin.Infrastructures.events.DomainEventAbstract;
import lombok.Getter;

import java.util.Collection;

@Getter
public class EmployeeBeforeEntryValidationByIdentityEvent extends DomainEventAbstract<String> {

    private final String areaCode;
    private final Collection<IdentityOccupationTypeInfo> idCardOccupationTypeInfos;

    public EmployeeBeforeEntryValidationByIdentityEvent(String areaCode, Collection<IdentityOccupationTypeInfo> idCardOccupationTypeInfos) {
        super(areaCode);
        this.areaCode = areaCode;
        this.idCardOccupationTypeInfos = idCardOccupationTypeInfos;
    }

    public static EmployeeBeforeEntryValidationByIdentityEvent create(String areaCode, Collection<IdentityOccupationTypeInfo> idCardOccupationTypeInfos) {
        return new EmployeeBeforeEntryValidationByIdentityEvent(areaCode, idCardOccupationTypeInfos);
    }

    @Getter
    public static class IdentityOccupationTypeInfo {
        private final boolean requiredPhoneAsLoginName;
        private final String number;
        private final OccupationType occupationType;

        public IdentityOccupationTypeInfo(boolean requiredPhoneAsLoginName, String number, OccupationType occupationType) {
            this.number = number;
            this.occupationType = occupationType;
            this.requiredPhoneAsLoginName = requiredPhoneAsLoginName;
        }

        public static IdentityOccupationTypeInfo create(boolean requiredPhoneAsLoginName, String number, OccupationType occupationType) {
            return new IdentityOccupationTypeInfo(requiredPhoneAsLoginName, number, occupationType);
        }
    }
}
