package com.zhongshu.card.client.model.orgModel;

import com.zhongshu.card.client.model.base.SuperModel;
import com.zhongshu.card.client.model.org.OrganizationRelationModel;
import com.zhongshu.card.client.model.org.UserCountSimpleModel;
import com.zhongshu.card.client.model.paySetting.paySetting.PayShareListModel;
import com.zhongshu.card.client.type.DataState;
import com.zhongshu.card.client.type.OrganizationRelationType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 项目绑定
 *
 * @author TRX
 * @date 2024/9/26
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProjectBindOrgModel extends SuperModel {

    @Schema(description = "主数据")
    private OrganizationRelationModel mainOrganization;

    public String getProjectOid() {
        if (ObjectUtils.isNotEmpty(mainOrganization)) {
            return mainOrganization.getOid();
        }
        return "";
    }

    @Schema(description = "关联数据")
    private OrganizationRelationModel relOrganization;

    private String orgOid;

    public String getOrgOid() {
        if (ObjectUtils.isNotEmpty(relOrganization)) {
            return relOrganization.getOid();
        }
        return "";
    }

    @Schema(description = "绑定关联类型")
    private OrganizationRelationType relationType;

    @Schema(description = "分账配置")
    private PayShareListModel payShareList;

    private String payShareListId;

    public String getPayShareListId() {
        if (ObjectUtils.isNotEmpty(payShareList)) {
            return payShareList.getId();
        }
        return "";
    }

    @Schema(description = "负责人userId")
    private List<String> managerUserIds;

    @Schema(description = "负责人信息列表")
    private List<UserCountSimpleModel> managerUserList = new ArrayList<>();

    @Schema(description = "数据状态")
    private DataState state = DataState.Enable;

}
