package com.jeequan.jeepay.db.entity;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.jeequan.jeepay.core.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 服务商信息表
 * </p>
 *
 * @author [mybatis plus generator]
 * @since 2022-03-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName(value = "t_product_info",autoResultMap = true)
public class ProductInfo extends BaseModel {

    public static final LambdaQueryWrapper<ProductInfo> gw(){
        return new LambdaQueryWrapper<>();
    }

    private static final long serialVersionUID=1L;

    /** 待上架 **/
    public static final Integer PRODUCT_STATE_NOT = 0;
    /** 已上架 **/
    public static final Integer PRODUCT_STATE_ON = 1;

    /** 需要审核 **/
    public static final Integer PRODUCT_STATE_AUDIT = 1;
    /** 不需要审核 **/
    public static final Integer PRODUCT_STATE_ON_AUDIT = 0;

    /** 需要绑定应用 **/
    public static final Integer PRODUCT_STATE_BINDING = 1;
    /** 不需要绑定应用 **/
    public static final Integer PRODUCT_STATE_ON_BINDING = 0;

    /** 收费 **/
    public static final Integer PRODUCT_STATE_CHARGE = 1;
    /** 不收费 **/
    public static final Integer PRODUCT_STATE_ON_CHARGE = 0;


    public static final String JSON_STR= "[{\"versionName\": \"免费版本\",\"validTime\": 365,\"sellingPrice\": 0.00,\"lineationPrice\": 0.00}]";

    public static final String API_CODE_FIRST= "API_";
    public static final String API_CODE_LAST= "_CP_PAY";


    /**
     * 产品ID
     */
    @TableId
    private String productId;

    /**
     * 产品名称
     */
    private String productName;

    /**
     * 产品简介
     */
    private String productDesc;

    /**
     * 产品付费信息
     */
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private JSONArray productText;

    /**
     * 排序
     */
    private Integer productSort;

    /**
     * 产品内容
     */
    private String productContent;

    /**
     * 开发文档地址
     */
    private String productUrl;

    /**
     * 产品状态 0-待上架 1-已上架
     */
    private Integer productState;

    /**
     * 产品分类
     */
    private Integer productType;

    /**
     * 产品logo地址
     */
    private String productLogoUrl;

    /**
     * 产品类型 0-服务型 1-接口型 数组[]
     */
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private JSONArray productSpecs;

    /**
     * 关联产品的ids，多个，逗号隔开
     */
    private String productIds;

    /**
     * 关联方案的id，多个，逗号隔开
     */
    private String packageIds;

    /**
     * 关联通道的code，多个，逗号隔开
     */
    private String payInterfaceCodes;

    /**
     * 固定功能代码
     */
    private String funcCode;

    /**
     * 定义的唯一标识，方便支付那边取值
     */
    private String apiCode;

    /**
     * 产品价格
     */
    private Long price;

    /**
     * 是否需要审核0:否；1:是
     */
    private Integer audit;

    /**
     * 是否收费0:否；1:是
     */
    private Integer charge;


    /**
     * 是否需要绑定应用0:否；1:是
     */
    private Integer bindingApp;

    /**
     * 产品特殊资质信息
     */
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private JSONArray specialCertificationText;

    /**
     * 是否需要资质0:否；1:是
     */
    private Integer certification;

    /**
     * 创建时间
     */
    private Date createdAt;

    /**
     * 更新时间
     */
    private Date updatedAt;

    /**
     * 创建者
     */
    private String createdBy;


    @TableField(exist = false)
    private Integer state;

    @TableField(exist = false)
    private String typeName;

    @TableField(exist = false)
    private String stateDesc;

    @TableField(exist = false)
    private String mchName;

    @TableField(exist = false)
    private String id;

    @TableField(exist = false)
    private Integer checkState;

    @TableField(exist = false)
    private List<ProductInfo> productInfoRelevancyList;

    @TableField(exist = false)
    private List<PackageInfo> packageInfoRelevancyList;

    @TableField(exist = false)
    private List<PayInterfaceDefine> payInterRelevancyList;

    @TableField(exist = false)
    private Integer applyCount;

    //申请数量
    @TableField(exist = false)
    private Integer applyForCount;

    //定订购数量
    @TableField(exist = false)
    private Integer orderCount;

    @TableField(exist = false)
    private Date firstDate;

    @TableField(exist = false)
    private Date lastDate;

    @TableField(exist = false)
    private List<String> bindingAppList;

    @TableField(exist = false)
    private String productIdsName;

    @TableField(exist = false)
    private String packageIdsName;

    @TableField(exist = false)
    private String payInterfaceCodesName;

    @TableField(exist = false)
    private List<PackageOrder> packageOrderList;

    /**
     * 剩余总时间
     */
    @TableField(exist = false)
    private Long allRemainingDays;

}
