package com.zcloud.zcGbsServicer.domain.model;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.jjb.saas.framework.domain.model.BaseE;
import com.zcloud.zcGbsServicer.domain.enums.PersonTypeEnum;
import lombok.Data;

import java.time.LocalDate;
import java.util.List;

/**
* web-domain
* @Author makejava
* @Date 2026-01-21 17:23:00
*/
@Data
public class RescueTeamE extends BaseE {
    private String teamId;
    private String teamName;
    private String teamType;
    private String teamTypeName;
    private String chargeOrgDept;
    private String captainName;
    private String captainPhone;
    private String longitude;
    private String latitude;
    private LocalDate establishDate;
    private String regionScope;
    private String regionScopeName;
    private String dutyScope;
    private String commandCrew;
    private List<ResourcePersonE> rescueMembers;

    public void addInit() {
        if (StrUtil.isBlank(this.teamId)) {
            this.teamId = IdUtil.simpleUUID();
        }
        if (CollectionUtil.isNotEmpty(this.rescueMembers)) {
            for (ResourcePersonE member : this.rescueMembers) {
                member.setBizId(this.teamId);
                member.setBizType(PersonTypeEnum.RESCUE_TEAM.getCode());
            }
        }
    }

    public void memberInfo(List<ResourcePersonE> teamMembers) {
        if (CollectionUtil.isNotEmpty(teamMembers)) {
            this.rescueMembers = teamMembers;
        }
    }
}
