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

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
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 org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Optional;

/**
 * 机构专辑采购
 * 2023-07-21 17:32:49
 */
@ApiModel(value = "TenantAlbumPurchaseWrapper对象", description = "机构专辑采购查询对象")
public class TenantAlbumPurchaseWrapper {

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" TenantAlbumPurchaseQuery-机构专辑采购")
    public static class TenantAlbumPurchaseQuery implements QueryInfo {

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

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

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

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


        @ApiModelProperty("采购状态 WAIT_PAY 待支付   PAID 已付款 CLOSE 已关闭")
        private String purchaseStatus;

        @ApiModelProperty("激活状态：NONE:未激活，PART：部分，ALL：全部")
        private String activeStatus;

        @ApiModelProperty("采购开始时间")
        private Date purchaseStartTime;

        @ApiModelProperty("采购结束时间")
        private Date purchaseEndTime;
        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }

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

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

    @Data
    @ApiModel(" TenantAlbumPurchase-机构专辑采购")
    public static class TenantAlbumPurchase {

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

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


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

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

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

        @ApiModelProperty("机构专辑图片")
        private String tenantAlbumImg;
        @ApiModelProperty("采购时间")
        private Date purchaseTime;

        @ApiModelProperty("购买数量")
        private Integer purchaseQuantity;

        @ApiModelProperty("采购周期")
        private Integer purchaseCycle;

        @ApiModelProperty("激活数量")
        private Integer activeQuantity;

        @ApiModelProperty("采购价格")
        private BigDecimal purchasePrice;

        @ApiModelProperty("采购状态")
        private String purchaseStatus;

        @ApiModelProperty("采购周期类型 DAY 日 MONTH 月 QUARTERLY 季度 YEAR_HALF 半年 YEAR 年")
        private String purchaseType;


        @ApiModelProperty("支付厂商")
        private String paymentVendor;

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

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

        @ApiModelProperty("激活状态：NONE:未激活，PART：部分，ALL：全部")
        private String activeStatus;

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

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

}