package com.kospo.talk.payload;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.kospo.talk.model.Work;
import com.kospo.talk.model.WorkS;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.util.List;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(name = "WorkDepthDto", description = "업무트리")
public class WorkDepthDto {
    @Schema(name = "workId", description = "업무아이디")
    private String workId;

    @Schema(name = "workNm", description = "업무이름")
    private String workNm;

    @Schema(name = "pWorkId", description = "상위 업무아이디")
    private String pWorkId;

    @Schema(name = "useYn", description = "사용여부")
    private boolean useYn;

    @Schema(name = "gubun", description = "레벨")
    private String gubun;


    public static WorkDepthDto to(Work work) {
        return WorkDepthDto.builder()
                .workId(work.getWorkId())
                .workNm(work.getWorkNm())
                .gubun(String.valueOf(work.getGubun()))
                .useYn(work.isUseYn())
                .pWorkId(work.getPWorkId())
                .build();
    }

}