package com.bcxin.tenant.domain.readers.dtos;

import com.bcxin.Infrastructures.enums.MasterSlaveType;
import com.bcxin.Infrastructures.enums.MemberType;
import com.bcxin.Infrastructures.enums.TrueFalseStatus;
import lombok.Getter;


@Getter
public class UserOrganBasicDto {
    private final String id;
    private final String organizationId;
    private final String employeeId;
    private final String name;
    private final MasterSlaveType masterSlaveType;
    private final boolean isDomainAdmin;
    private final String areaCode;
    private boolean isDepartAdmin = false;

    private final String orgName;

    public UserOrganBasicDto(String id, String name, String organizationId,String orgName, String areaCode, String employeeId, MasterSlaveType masterSlaveType, TrueFalseStatus domainAdmin) {
        this.id = id;
        this.name = name;
        this.organizationId = organizationId;
        this.areaCode = areaCode;
        this.employeeId = employeeId;
        this.masterSlaveType = masterSlaveType;
        this.isDomainAdmin = domainAdmin == TrueFalseStatus.True;
        this.orgName = orgName;
    }

    public UserOrganBasicDto(String id, String name, String organizationId, String orgName, String areaCode, String employeeId, MemberType memberType) {
        this.id = id;
        this.name = name;
        this.organizationId = organizationId;
        this.areaCode = areaCode;
        this.employeeId = employeeId;
        this.masterSlaveType = memberType == MemberType.Master ? MasterSlaveType.Master : MasterSlaveType.Normal;
        this.isDomainAdmin = memberType == MemberType.Master;
        this.orgName = orgName;
    }

    public void setDepartAdmin(boolean isDepartAdmin) {
        this.isDepartAdmin = isDepartAdmin;
    }
}
