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("FcltWorkStepDto(사업단계 코드 정보)")
public class FcltWorkStepDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("사업단계코드")
    @JsonProperty("work_step")
    private String workStep;

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

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

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

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

        return dto;
    }
}
