package com.its.op.entity.its.weather;

import com.its.op.dto.its.weather.TbAtmpPltnSttnDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 대기 오염 측정소 Entity Class
 */
@Getter
@NoArgsConstructor//(access = AccessLevel.PROTECTED)
@Builder
@AllArgsConstructor
@ApiModel("대기 오염 측정소")
@Entity
@Table(name = "TB_ATMP_PLTN_STTN")
public class TbAtmpPltnSttn implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("측정소 번호")  // N NUMBER(10)
    @Id
    @Column(name = "ATMP_STTN_NMBR", nullable = false, columnDefinition = "NUMBER", length = 10)
    private Long atmpSttnNmbr;

    @ApiModelProperty("측정소 명")  // N VARCHAR(30)
    @Column(name = "ATMP_STTN_NM", nullable = false, length = 30)
    private String atmpSttnNm;

    @ApiModelProperty("VMS 표출명")  // N VARCHAR(30)
    @Column(name = "VMS_DISP_NM", nullable = false, length = 30)
    private String vmsDispNm;

    @ApiModelProperty("측정소 주소")  // Y VARCHAR(200)
    @Column(name = "ATMP_STTN_ADDR", length = 200)
    private String atmpSttnAddr;

    @ApiModelProperty("설치 년도")  // Y VARCHAR(4)
    @Column(name = "ISTL_YY", length = 4)
    private String istlYy;

    @ApiModelProperty("관리 기관 명")  // Y VARCHAR(100)
    @Column(name = "MNGM_INTN_NM", length = 100)
    private String mngmIntnNm;

    @ApiModelProperty("측정 시스템 명")  // Y VARCHAR(10)
    @Column(name = "MSRM_SYST_NM", length = 10)
    private String msrmSystNm;

    @ApiModelProperty("측정 항목")  // Y VARCHAR(100)
    @Column(name = "MSRM_ITEM", length = 100)
    private String msrmItem;

    @ApiModelProperty("X 좌표")  // Y NUMBER(11,8)
    @Column(name = "X_CRDN", columnDefinition = "NUMBER", length = 11, precision = 8)
    private Double xCrdn;

    @ApiModelProperty("Y 좌표")  // Y NUMBER(10,8)
    @Column(name = "Y_CRDN", columnDefinition = "NUMBER", length = 10, precision = 8)
    private Double yCrdn;

    @ApiModelProperty("삭제 여부")  // Y CHAR(1)
    @Column(name = "DEL_YN", columnDefinition = "CHAR", length = 1)
    private String delYn;

    public TbAtmpPltnSttnDto toDto() {
        return TbAtmpPltnSttnDto.builder()
                .atmpSttnNmbr(this.atmpSttnNmbr)
                .atmpSttnNm(this.atmpSttnNm)
                .vmsDispNm(this.vmsDispNm)
                .atmpSttnAddr(this.atmpSttnAddr)
                .istlYy(this.istlYy)
                .mngmIntnNm(this.mngmIntnNm)
                .msrmSystNm(this.msrmSystNm)
                .msrmItem(this.msrmItem)
                .xCrdn(this.xCrdn)
                .yCrdn(this.yCrdn)
                .delYn(this.delYn)
                .build();
    }

    public TbAtmpPltnSttn(Long atmpSttnNmbr) {
        this.atmpSttnNmbr = atmpSttnNmbr;
    }

}
