package com.xy.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

@Data
@ApiModel("菜单交互类")
@Accessors(chain = true)
public class SysMenuDto {

    @Data
    @ApiModel("业务用户菜单树")
    @Accessors(chain = true)
    public static class WorkMenu {

        @NotNull(message = "systemId不能为空")
        @ApiModelProperty(value = "系统id", required = true)
        private Long sysId;
    }

    @Data
    @ApiModel("添加")
    @Accessors(chain = true)
    public static class Save {

        @NotNull(message = "systemId不能为空")
        @ApiModelProperty(value = "系统id", required = true)
        private Long sysId;

        @NotBlank(message = "code不能为空")
        @ApiModelProperty(value = "标识", required = true)
        private String code;

        @ApiModelProperty(value = "名称", required = true)
        private String name;

        @ApiModelProperty(value = "类型;1=目录 2=菜单 3=数据接口/按钮", required = true)
        private Integer type;

        @ApiModelProperty(value = "父菜单id")
        private Long paterId;

        @ApiModelProperty("数据接口uri")
        private String interfaceUri;

        @ApiModelProperty("前端参数")
        private String webJson;

        @ApiModelProperty("路由")
        private String route;

        @ApiModelProperty("排序;倒序")
        private Integer orders;

        @ApiModelProperty("图标")
        private String icon;
    }

    @Data
    @ApiModel("修改")
    @Accessors(chain = true)
    public static class Update {

        @NotNull(message = "id不能为空")
        @ApiModelProperty(value = "菜单id", required = true)
        private Long id;

        @ApiModelProperty(value = "名称")
        private String name;

        @ApiModelProperty(value = "类型;1=目录 2=菜单 3=数据接口/按钮")
        private Integer type;

        @ApiModelProperty(value = "父菜单id")
        private Long paterId;

        @ApiModelProperty("数据接口uri")
        private String interfaceUri;

        @ApiModelProperty("前端参数")
        private String webJson;

        @ApiModelProperty("路由")
        private String route;

        @ApiModelProperty("排序;倒序")
        private Integer orders;

        @ApiModelProperty("图标")
        private String icon;
    }

    @Data
    @ApiModel("删除")
    @Accessors(chain = true)
    public static class Del {

        @NotEmpty(message = "id不能为空")
        @ApiModelProperty(value = "菜单id", required = true)
        private List<Long> id;

    }

    @Data
    @ApiModel("返参类")
    @Accessors(chain = true)
    public static class Vo {

        @ApiModelProperty("父id")
        private Long paterId;

        @ApiModelProperty("系统id")
        private Long sysId;

        @ApiModelProperty("标识")
        private String code;

        @ApiModelProperty("名称")
        private String name;

        @ApiModelProperty("类型;1=目录 2=菜单 3=数据接口/按钮")
        private Integer type;

        @ApiModelProperty("数据接口uri")
        private String interfaceUri;

        @ApiModelProperty("前端参数")
        private String webJson;

        @ApiModelProperty("状态")
        private Boolean status;

        @ApiModelProperty("唯一标识")
        private Long id;

        @ApiModelProperty("创建时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime createTime;

        @ApiModelProperty("更新时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime updateTime;

        @ApiModelProperty("创建人")
        private Long createUser;

        @ApiModelProperty("更新人")
        private Long updateUser;

        @ApiModelProperty("路由")
        private String route;

        @ApiModelProperty("排序;倒序")
        private Integer orders;

        @ApiModelProperty("图标")
        private String icon;

        @ApiModelProperty("管理员查询权限")
        private Boolean selectAdmin;

        @ApiModelProperty("子级集合")
        private List<Vo> sonSysMenu;
    }

}
