package com.supervision.police.dto;

import com.supervision.police.domain.SystemMenu;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;
import java.util.Objects;

@Data
public class MenuDTO {

    @Schema(description = "菜单id")
    private String id;

    @Schema(description = "标签(菜单名或按钮名)")
    private String label;

    @Schema(description = "标签码 前端权限使用")
    private String labelCode;

    @Schema(description = "标签类型 0: 菜单 1:标签 默认菜单")
    private Integer labelType;

    @Schema(description = "父级id")
    private String parentId;

    @Schema(description = "子菜单")
    private List<MenuDTO> children;

    public MenuDTO() {
    }

    public MenuDTO(SystemMenu systemMenu) {
        if (Objects.isNull(systemMenu)){
            return;
        }
        this.id = systemMenu.getId();
        this.label = systemMenu.getLabel();
        this.labelCode = systemMenu.getLabelCode();
        this.labelType = systemMenu.getLabelType();
        this.parentId = systemMenu.getParentId();
    }
}