package com.its.op.dto.its.facility;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.code.TbCmmnCd;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("FcltFailWthrDto(장애날씨 코드 정보)")
public class FcltFailWthrDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("장애날씨코드")
    @JsonProperty("wthr_cd")
    private String wthrCd;

    @ApiModelProperty("코드명")
    @JsonProperty("name")
    private String name;

    @ApiModelProperty("코드설명")
    @JsonProperty("desc")
    private String desc;

    public static FcltFailWthrDto makeDto(TbCmmnCd entity) {
        FcltFailWthrDto dto = FcltFailWthrDto.builder()
                .wthrCd(entity.getCmmnCd())
                .name(entity.getCmmnCdKorNm())
                .build();

        dto.setDesc( "[" + entity.getCmmnCd() + "] " + entity.getCmmnCdKorNm());

        return dto;
    }
}
