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

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.microsvc.toolkit.common.response.paging.QueryInfo;
import com.yonge.cooleshow.biz.dal.entity.TenantAlbumCategoryDetail;
import com.yonge.cooleshow.common.enums.ETenantAlbumCategoryType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotNull;

/**
 * 机构专辑分类
 * 2023-10-10 09:48:46
 */
@ApiModel(value = "TenantAlbumCategoryWrapper对象", description = "机构专辑分类查询对象")
public class TenantAlbumCategoryWrapper {

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" TenantAlbumCategoryQuery-机构专辑分类")
    public static class TenantAlbumCategoryQuery implements QueryInfo {

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

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

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

        @ApiModelProperty("分类类别")
        private ETenantAlbumCategoryType categoryType;

        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }

        public String jsonString() {
            return JSON.toJSONString(this);
        }

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

    @Data
    @ApiModel(" TenantAlbumCategory-机构专辑分类")
    public static class TenantAlbumCategory {

        @ApiModelProperty("主键ID")
        private Long id;

        @ApiModelProperty("专辑分类名称")
        @NotNull(message = "专辑分类名称不能为空")
        private String name;

        @ApiModelProperty("专辑分类类别")
        private ETenantAlbumCategoryType categoryType;

        @ApiModelProperty("删除标记")
        private Boolean delFlag;

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

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

        @ApiModelProperty("修改人")
        private Long updateBy;

        @ApiModelProperty("更新时间")
        private Date updateTime;

        @ApiModelProperty("专辑分类级别/类别值")
        private List<TenantAlbumCategoryDetail> values = new ArrayList<>();

        public String jsonString() {
            return JSON.toJSONString(this);
        }

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

}