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

import com.its.op.dto.its.weather.TbVilgFrcsZoneDto;
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_VILG_FRCS_ZONE")
public class TbVilgFrcsZone implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("동네 예보 구역 코드")  // N NUMBER(14)
    @Id
    @Column(name = "VILG_FRCS_ZONE_CD", nullable = false, columnDefinition = "NUMBER", length = 14)
    private Long vilgFrcsZoneCd;

    @ApiModelProperty("동네 예보 구역 명")  // Y VARCHAR(40)
    @Column(name = "VILG_FRCS_ZONE_NM", length = 40)
    private String vilgFrcsZoneNm;

    @ApiModelProperty("")  // Y NUMBER(3)
    @Column(name = "gridx", columnDefinition = "NUMBER", length = 3)
    private Integer gridx;

    @ApiModelProperty("")  // Y NUMBER(3)
    @Column(name = "gridy", columnDefinition = "NUMBER", length = 3)
    private Integer gridy;

    public TbVilgFrcsZoneDto toDto() {
        return TbVilgFrcsZoneDto.builder()
                .vilgFrcsZoneCd(this.vilgFrcsZoneCd)
                .vilgFrcsZoneNm(this.vilgFrcsZoneNm)
                .gridx(this.gridx)
                .gridy(this.gridy)
                .build();
    }

    public TbVilgFrcsZone(Long vilgFrcsZoneCd) {
        this.vilgFrcsZoneCd = vilgFrcsZoneCd;
    }

}
