package incheon.ags.ias.sysMenuAuthrt.web.dto;

import incheon.ags.ias.sysMenuAuthrt.vo.SysMenuAuthrtVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;

@Getter
@Setter
public class SysMenuAuthrtRequestDTO {

    @Schema(description = "메뉴 코드", example = "MENU001", required = true)
    @NotBlank(message = "메뉴 코드는 필수 항목입니다.")
    private String menuCd;

    @Schema(description = "메뉴 명", example = "게시판 설정")
    private String menuNm;

    @Schema(description = "상위 메뉴 코드", example = "MENU000")
    private String upMenuCd;

    @Schema(description = "권한 코드", example = "AUTH001")
    private String authrtCd;

    @Schema(description = "상위 메뉴 명", example = "설정 관리")
    private String upMenuNm;

    @Schema(description = "메뉴 정렬 순서", example = "1")
    private int menuSortSeq;

    @Schema(description = "썸네일 경로명", example = "/images/thumbs/")
    private String thmbPathNm;

    @Schema(description = "썸네일명", example = "menu_icon.png")
    private String thmbNm;

    @Schema(description = "현재 사용 여부", example = "true")
    private String useYn;

    @Schema(description = "메뉴 URL 주소", example = "/admin/board/setting")
    private String menuUrlAddr;

    @Schema(description = "시스템 코드", example = "SYS001", required = true)
    @NotBlank(message = "시스템 코드는 필수 항목입니다.")
    private String sysCd;

    @Schema(description = "시스템 레벨", example = "1")
    private Integer level;

    @Schema(description = "하위 메뉴 존재 여부", example = "true")
    private Boolean hasChildren;

    @Schema(description = "정렬 경로", example = "001.001")
    private String sortPath;

    @Schema(description = "역할 코드", example = "ROLE001")
    private String roleCd;

    @Schema(description = "역할 명", example = "시스템관리자")
    private String roleNm;

    @Schema(description = "역할 설명", example = "시스템 전체 관리 권한")
    private String roleExpln;

    @Schema(description = "역할 유형", example = "ADMIN")
    private String roleType;

    @Schema(description = "권한 유형", example = "MENU")
    private String authrtType;

    @Schema(description = "대상 시스템 코드", example = "SYS001")
    private String trgtSysCd;

    @Schema(description = "대상 메뉴 코드", example = "MENU001")
    private String trgtMenuCd;

    @Schema(description = "생성 일시")
    private LocalDateTime createDt;

    @Schema(description = "수정 일시")
    private LocalDateTime updtDt;

    @Schema(description = "비고", example = "관리자 전용 메뉴")
    private String rmrkCn;

    public SysMenuAuthrtVO toEntity() {
        SysMenuAuthrtVO vo = new SysMenuAuthrtVO();
        vo.setMenuCd(this.menuCd);
        vo.setMenuNm(this.menuNm);
        vo.setUpMenuCd(this.upMenuCd);
        vo.setAuthrtCd(this.authrtCd);
        vo.setUpMenuNm(this.upMenuNm);
        vo.setMenuSortSeq(this.menuSortSeq);
        vo.setThmbPathNm(this.thmbPathNm);
        vo.setThmbNm(this.thmbNm);
        vo.setUseYn(this.useYn);
        vo.setMenuUrlAddr(this.menuUrlAddr);
        vo.setSysCd(this.sysCd);
        vo.setLevel(this.level);
        vo.setHasChildren(this.hasChildren);
        vo.setSortPath(this.sortPath);
        vo.setRoleCd(this.roleCd);
        vo.setRoleNm(this.roleNm);
        vo.setRoleExpln(this.roleExpln);
        vo.setRoleType(this.roleType);
        vo.setAuthrtType(this.authrtType);
        vo.setTrgtSysCd(this.trgtSysCd);
        vo.setTrgtMenuCd(this.trgtMenuCd);
        vo.setCreateDt(this.createDt);
        vo.setUpdtDt(this.updtDt);
        vo.setRmrkCn(this.rmrkCn);
        return vo;
    }

}
