package com.yonge.cooleshow.biz.dal.wrapper;

import com.alibaba.fastjson.JSON;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 区域表
 * 2022-11-23 18:28:58
 */
public class SysAreaWrapper {

    @Data
	@Builder
    @NoArgsConstructor
	@AllArgsConstructor
    public static class SysAreaQuery implements QueryInfo {

        @ApiModelProperty(value = "当前页")
        private Integer page;

        @ApiModelProperty(value = "分页行数")
        private Integer rows;

    	@ApiModelProperty(value = "父节点")
    	private Integer parentId;

    	@ApiModelProperty(value = "关键字匹配")
		private String keyword;

    }

    @Data
	@Builder
	@NoArgsConstructor
	@AllArgsConstructor
    @ApiModel("省份区域")
    public static class SysArea {

        @ApiModelProperty("主键Id")
		private Integer id;

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

		@ApiModelProperty("编码")
		private Integer code;

		@ApiModelProperty("创建时间")
		private Date createTime;

		@ApiModelProperty("修改时间")
		private Date updateTime;

		@ApiModelProperty("是否删除  -1：已删除  0：正常")
		private String delFlag;

        @ApiModelProperty("父节点编号")
        private Integer parentOrganId;

        @ApiModelProperty("子节点数")
        private Integer number;

        @ApiModelProperty("城市")
        private List<City> areas;

        public static SysArea from(String json) {
            return JSON.parseObject(json, SysArea.class);
        }
	}

    @Data
    @ApiModel("城市")
    public static class City implements Serializable {

        @ApiModelProperty("主键Id")
        private Integer id;

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

        @ApiModelProperty("编码")
        private Integer code;

        @ApiModelProperty("父节点编号")
        private Integer parentOrganId;
    }
}
