package com.xy.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
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
@Accessors(chain = true)
public class SysMenuDto {

    @Data
    @Accessors(chain = true)
    public static class WorkMenu {

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

        @ApiModelProperty(value = "客户端类型")
        private String clientType;
    }

    @Data
    @Accessors(chain = true)
    public static class SysMenu {

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

        @ApiModelProperty(value = "客户端类型")
        private String clientType;
    }

    @Data
    @Accessors(chain = true)
    public static class WorkMenuList {

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

        @ApiModelProperty(value = "客户端类型")
        private String clientType;
    }

    @Data
    @Accessors(chain = true)
    public static class RoleAdminMenuIdsDto {

        @NotNull(message = "角色ID不能为空")
        @ApiModelProperty(value = "角色ID", required = true)
        private Long roleId;

    }

    @Data
    @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;

        @NotBlank(message = "name不能为空")
        @ApiModelProperty(value = "名称", required = true)
        private String name;

        /**
         * 英文名称
         */
        @ApiModelProperty(value = "英文名称", required = true)
        private String enName;


        @NotNull(message = "type不能为空")
        @ApiModelProperty(value = "类型", required = true)
        private Integer type;

        @NotBlank(message = "clientType不能为空")
        @ApiModelProperty(value = "客户端类型", required = true)
        private String clientType;

        @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;

        /**
         * 路由地址 跟服务走的
         */
        @ApiModelProperty("路由地址 跟服务走的")
        private String path;

        /**
         * 小程序菜单图标
         */
        @ApiModelProperty("小程序菜单图标")
        private String miniMenuIcon;

        @ApiModelProperty("备注")
        private String remark;
    }

    @Data
    @Accessors(chain = true)
    public static class Update {

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

        /**
         * 英文名称
         */
        @ApiModelProperty(value = "英文名称", required = true)
        private String enName;


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

        @ApiModelProperty(value = "类型")
        private Integer type;

        @ApiModelProperty(value = "客户端类型")
        private String clientType;

        @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;

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

        /**
         * 路由地址 跟服务走的
         */
        @ApiModelProperty("路由地址 跟服务走的")
        private String path;

        /**
         * 小程序菜单图标
         */
        @ApiModelProperty("小程序菜单图标")
        private String miniMenuIcon;

        @ApiModelProperty("备注")
        private String remark;

    }

    @Data
    @Accessors(chain = true)
    public static class Del {

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

    }

    @Data
    @Accessors(chain = true)
    public static class MenuVo {

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

        @ApiModelProperty("系统code")
        private String code;

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

        /**
         * 英文名称
         */
        @ApiModelProperty(value = "英文名称", required = true)
        private String enName;


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

        @ApiModelProperty("菜单")
        private List<Vo> menu;
    }

    @Data
    @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(value = "英文名称", required = true)
        private String enName;


        @ApiModelProperty("类型")
        private Integer type;

        @ApiModelProperty("客户端类型")
        private String clientType;

        @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;

        /**
         * 路由地址 跟服务走的
         */
        @ApiModelProperty("路由地址 跟服务走的")
        private String path;

        /**
         * 小程序菜单图标
         */
        @ApiModelProperty("小程序菜单图标")
        private String miniMenuIcon;

        @ApiModelProperty("备注")
        private String remark;
    }

}
