package com.its.api.its.model.dto.facility;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.api.its.model.entity.facility.TbFcltCmpy;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 시설물업체 DTO Class
 */
@Data
@Builder
@ApiModel("TbFcltCmpyDto(시설물업체)")
public class TbFcltCmpyDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("업체 ID")  // N VARCHAR(30)
    @JsonProperty("cmpy_id")
    private String cmpyId;

    @ApiModelProperty("업체 명")  // Y VARCHAR(30)
    @JsonProperty("cmpy_nm")
    private String cmpyNm;

    @ApiModelProperty("사업자 등록 번호")  // Y VARCHAR(30)
    @JsonProperty("brno")
    private String brno;

    @ApiModelProperty("주소")  // Y VARCHAR(200)
    @JsonProperty("addr")
    private String addr;

    @ApiModelProperty("전화번호")  // Y VARCHAR(128)
    @JsonProperty("tel")
    private String tel;

    @ApiModelProperty("팩스 번호")  // Y VARCHAR(128)
    @JsonProperty("fcsm_nmbr")
    private String fcsmNmbr;

    @ApiModelProperty("대표자 명")  // Y VARCHAR(30)
    @JsonProperty("rprv_nm")
    private String rprvNm;

    @ApiModelProperty("담당자 명")  // Y VARCHAR(30)
    @JsonProperty("chgr_nm")
    private String chgrNm;

    @ApiModelProperty("담당자 연락처")  // Y VARCHAR(128)
    @JsonProperty("chgr_hp_nmbr")
    private String chgrHpNmbr;

    @ApiModelProperty("담당자 이메일")  // Y VARCHAR(128)
    @JsonProperty("chgr_emal")
    private String chgrEmal;

    /*@ApiModelProperty("추가자 명")  // Y VARCHAR(30)
    @JsonProperty("adtn_nm")*/
    @JsonIgnore
    private String adtnNm;

    /*@ApiModelProperty("추가 일시")  // Y VARCHAR(14)
    @JsonProperty("adtn_dt")*/
    @JsonIgnore
    private String adtnDt;

    /*@ApiModelProperty("변경자 명")  // Y VARCHAR(30)
    @JsonProperty("chng_nm")*/
    @JsonIgnore
    private String chngNm;

    /*@ApiModelProperty("변경 일시")  // Y VARCHAR(14)
    @JsonProperty("chng_dt")*/
    @JsonIgnore
    private String chngDt;

    @ApiModelProperty("삭제 여부")  // Y CHAR(1)
    @JsonProperty("del_yn")
    private String delYn;

    // Code Description Field

    @ApiModel("TbFcltCmpyUpdReq(시설물업체 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor(access = AccessLevel.PROTECTED)
    public static class TbFcltCmpyUpdReq {

        @ApiModelProperty("업체 ID, Nullable = N, VARCHAR(30)")  // N VARCHAR(30)
        @JsonProperty("cmpy_id")
        @Size(min=1, max=30)
        private String cmpyId;

        @ApiModelProperty("업체 명, Nullable = Y, VARCHAR(30)")  // Y VARCHAR(30)
        @JsonProperty("cmpy_nm")
        @Size(min=1, max=30)
        private String cmpyNm;

        @ApiModelProperty("사업자 등록 번호, Nullable = Y, VARCHAR(30)")  // Y VARCHAR(30)
        @JsonProperty("brno")
        @Size(min=1, max=30)
        private String brno;

        @ApiModelProperty("주소, Nullable = Y, VARCHAR(200)")  // Y VARCHAR(200)
        @JsonProperty("addr")
        @Size(min=1, max=200)
        private String addr;

        @ApiModelProperty("전화번호, Nullable = Y, VARCHAR(128)")  // Y VARCHAR(128)
        @JsonProperty("tel")
        @Size(min=1, max=128)
        private String tel;

        @ApiModelProperty("팩스 번호, Nullable = Y, VARCHAR(128)")  // Y VARCHAR(128)
        @JsonProperty("fcsm_nmbr")
        @Size(min=1, max=128)
        private String fcsmNmbr;

        @ApiModelProperty("대표자 명, Nullable = Y, VARCHAR(30)")  // Y VARCHAR(30)
        @JsonProperty("rprv_nm")
        @Size(min=1, max=30)
        private String rprvNm;

        @ApiModelProperty("담당자 명, Nullable = Y, VARCHAR(30)")  // Y VARCHAR(30)
        @JsonProperty("chgr_nm")
        @Size(min=1, max=30)
        private String chgrNm;

        @ApiModelProperty("담당자 연락처, Nullable = Y, VARCHAR(128)")  // Y VARCHAR(128)
        @JsonProperty("chgr_hp_nmbr")
        @Size(min=1, max=128)
        private String chgrHpNmbr;

        @ApiModelProperty("담당자 이메일, Nullable = Y, VARCHAR(128)")  // Y VARCHAR(128)
        @JsonProperty("chgr_emal")
        @Size(min=1, max=128)
        private String chgrEmal;

        /*@ApiModelProperty("추가자 명, Nullable = Y, VARCHAR(30)")  // Y VARCHAR(30)
        @JsonProperty("adtn_nm")
        @Size(min=1, max=30)*/
        @JsonIgnore
        private String adtnNm;

        /*@ApiModelProperty("추가 일시, Nullable = Y, VARCHAR(14)")  // Y VARCHAR(14)
        @JsonProperty("adtn_dt")
        @Size(min=1, max=14)*/
        @JsonIgnore
        private String adtnDt;

        /*@ApiModelProperty("변경자 명, Nullable = Y, VARCHAR(30)")  // Y VARCHAR(30)
        @JsonProperty("chng_nm")
        @Size(min=1, max=30)*/
        @JsonIgnore
        private String chngNm;

        /*@ApiModelProperty("변경 일시, Nullable = Y, VARCHAR(14)")  // Y VARCHAR(14)
        @JsonProperty("chng_dt")
        @Size(min=1, max=14)*/
        @JsonIgnore
        private String chngDt;

        @ApiModelProperty("삭제 여부, Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("del_yn")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String delYn;

        @Builder
        public TbFcltCmpyUpdReq(String cmpy_id, String cmpy_nm, String brno, String addr, String tel, String fcsm_nmbr, String rprv_nm, String chgr_nm, String chgr_hp_nmbr, String chgr_emal, String adtn_nm, String adtn_dt, String chng_nm, String chng_dt, String del_yn) {
            this.cmpyId = cmpy_id;
            this.cmpyNm = cmpy_nm;
            this.brno = brno;
            this.addr = addr;
            this.tel = tel;
            this.fcsmNmbr = fcsm_nmbr;
            this.rprvNm = rprv_nm;
            this.chgrNm = chgr_nm;
            this.chgrHpNmbr = chgr_hp_nmbr;
            this.chgrEmal = chgr_emal;
            this.adtnNm = adtn_nm;
            this.adtnDt = adtn_dt;
            this.chngNm = chng_nm;
            this.chngDt = chng_dt;
            this.delYn = del_yn;
        }

        public TbFcltCmpy toEntity() {
            return TbFcltCmpy.builder()
                    .cmpyId(this.cmpyId)
                    .cmpyNm(this.cmpyNm)
                    .brno(this.brno)
                    .addr(this.addr)
                    .tel(this.tel)
                    .fcsmNmbr(this.fcsmNmbr)
                    .rprvNm(this.rprvNm)
                    .chgrNm(this.chgrNm)
                    .chgrHpNmbr(this.chgrHpNmbr)
                    .chgrEmal(this.chgrEmal)
                    .adtnNm(this.adtnNm)
                    .adtnDt(this.adtnDt)
                    .chngNm(this.chngNm)
                    .chngDt(this.chngDt)
                    .delYn(this.delYn)
                    .build();
        }

    }

}
