package com.muyu.system.domain.resp;

import com.muyu.common.system.domain.SysEnt;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 企业管理响应对象
 * @Author: zi run
 * @Date 2024/9/26 0:42
 * @Description 企业管理响应对象
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EntResp {

    /**
     * 企业ID
     */
    @Schema(title = "企业ID", type = "Long", defaultValue = "1", description = "企业ID")
    private Long entId;

    /**
     * 企业名称
     */
    @Schema(title = "企业名称", type = "String", defaultValue = "长安汽车", description = "企业名称")
    private String entName;

    /**
     * 负责人
     */
    @Schema(title = "负责人", type = "String", defaultValue = "张三", description = "负责人")
    private String leader;

    /**
     * 手机号码
     */
    @Schema(title = "手机号码", type = "String", defaultValue = "18321974313", description = "手机号码")
    private String phoneNumber;

    /**
     * 邮箱
     */
    @Schema(title = "邮箱", type = "String", defaultValue = "12123@qq.com", description = "邮箱账号")
    private String email;

    /**
     * 企业编码
     */
    @Schema(title = "企业编码", type = "String", defaultValue = "db", description = "连接的数据源")
    private String entCode;

    /**
     * 企业状态
     */
    @Schema(title = "企业状态", type = "Integer", defaultValue = "0", description = "企业状态(待处理(0),通过(1),未通过(2))")
    private Integer entStatus;

    /**
     * 企业管理响应对象构建者模式
     * @param sysEnt 企业管理
     * @return 企业信息响应对象
     */
    public static EntResp entBuild(SysEnt sysEnt) {
        return EntResp.builder()
                .entId(sysEnt.getId())
                .entName(sysEnt.getName())
                .leader(sysEnt.getLeader())
                .phoneNumber(sysEnt.getPhone())
                .email(sysEnt.getEmail())
                .entCode(sysEnt.getEntCode())
                .entStatus(sysEnt.getEntStatus())
                .build();
    }
}
