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.enums.ClientEnum;
import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.util.Optional;

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

/**
 * 购买训练工具记录
 * 2023-07-24 13:32:24
 */
@ApiModel(value = "UserTenantAlbumRecordWrapper对象", description = "购买训练工具记录查询对象")
public class UserTenantAlbumRecordWrapper {

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" UserTenantAlbumRecordQuery-购买训练工具记录")
    public static class UserTenantAlbumRecordQuery implements QueryInfo {
    
    	@ApiModelProperty("当前页")
        private Integer page;
        
        @ApiModelProperty("分页行数")
        private Integer rows;
        
        @ApiModelProperty("关键字匹配")
		private String keyword;

        @ApiModelProperty("用户Id")
        private Long userId;

        @ApiModelProperty("开始时间")
        private Date startTime;

        @ApiModelProperty("结束时间")
        private Date endTime;

        @ApiModelProperty("ORDER:激活码激活，TENANT：自行购买，BACKEND_GIVE：后台添加")
        private SourceTypeEnum sourceType;

        @ApiModelProperty("机构ID")
        private Long tenantId;

        @ApiModelProperty("小组ID")
        private Long tenantGroupId;

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

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

    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Data
	@ApiModel(" UserTenantAlbumRecord-购买训练工具记录")
    public static class UserTenantAlbumRecord {

        @ApiModelProperty("记录id")
        private Long id;

        @ApiModelProperty("用户id")
        private Long userId;

        @ApiModelProperty("手机号")
        private String phone;

        @ApiModelProperty("机构ID")
        private Long tenantId;

        @ApiModelProperty("机构专辑ID")
        private Long tenantAlbumId;

        @ApiModelProperty("机构专辑ID")
        private String tenantAlbumName;

        @ApiModelProperty("机构专辑ID")
        private String tenantAlbumCoverImg;

        @ApiModelProperty("订单号")
        private String orderNo;

        @ApiModelProperty("ORDER:激活码激活，TENANT：自行购买，BACKEND_GIVE：后台添加")
        private SourceTypeEnum sourceType;

        @ApiModelProperty("购买人员类型 TEACHRE :老师端 STUDNET : 学生端")
        private ClientEnum clientType;

        @ApiModelProperty("订单详情号")
        private String subOrderNo;

        @ApiModelProperty("开始时间")
        private Date startTime;

        @ApiModelProperty("结束时间")
        private Date endTime;

        @ApiModelProperty("时间类型 DAY:天 MONTH:月，YEAR:年")
        private String type;

        @ApiModelProperty("添加时间数量")
        private Integer times;

        @ApiModelProperty("消息发送 0、未发送 1、已发送提前3天消息 2、已发送会员过期消息 暂时不用")
        private Boolean msgStatus;

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

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

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

        @ApiModelProperty("创建人")
        private String createName;

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

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

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

}