package com.kospo.talk.payload;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.kospo.talk.model.SmUser;
import com.kospo.talk.model.Work;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import jakarta.validation.constraints.Size;
import lombok.*;

import java.util.List;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(name = "SmUserDto", description = "유지보수관리")
public class SmUserDto {
    @Schema(name = "sabun", description = "사번")
    private String sabun;

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

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

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

    @Schema(name = "onlineYn", description = "온라인여부")
    private Boolean onlineYn;



    public static SmUserDto to(SmUser smUser) {
        return SmUserDto.builder()
                .sabun(smUser.getId().getSabun())
                .name(smUser.getName())
                .workId(smUser.getId().getWorkId()).build();
    }

    public static SmUserDto iTo(ISmUserDto smUser) {
        return SmUserDto.builder()
                .sabun(smUser.getSabun())
                .name(smUser.getName())
                .onlineYn(smUser.getOnlineYn())
                .workId(smUser.getWorkId()).build();
    }
}