package com.zcloud.zcGbsServicer.domain.model;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.cola.domain.Entity;
import com.jjb.saas.framework.domain.model.BaseE;
import com.zcloud.gbscommon.utils.Tools;
import com.zcloud.zcGbsServicer.domain.enums.DeviceTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
* web-domain
* @Author makejava
* @Date 2026-01-21 17:22:16
*/
@Data
public class PumpRoomE extends BaseE {
    //业务主键ID
    private String pumpRoomId;
    //消防泵房名称
    private String pumpRoomName;
    //消防泵房状态(字典码)
    private String pumpRoomStatus;
    //负责人
    private String principalName;
    //负责人手机号
    private String principalPhone;
    //经度
    private Double lng;
    //纬度
    private Double lat;

    //设备集合
    private List<ResourceDeviceE> devices;

    //设备数量
    private Integer deviceCount;

    public void addInit(List<ResourceDeviceE> devices) {
        if (StrUtil.isBlank(this.pumpRoomId)) {
            this.pumpRoomId = Tools.get32UUID();
        }
        if (CollUtil.isNotEmpty(devices)) {
            for (ResourceDeviceE device : devices) {
                device.setBizId(this.pumpRoomId);
                device.setBizType(DeviceTypeEnum.PUMP_ROOM.getCode());
            }
            this.devices = devices;
        }
    }

    public void device(List<ResourceDeviceE>  devices) {
        this.deviceCount = CollUtil.isNotEmpty(devices) ? devices.size() : 0;
    }

    public void deviceInfo(List<ResourceDeviceE>  devices) {
        if (CollUtil.isNotEmpty(devices)) {
            this.devices = devices;
        }
    }
}

