package com.bohuikeji.delivery.backstage.entity.discount;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bohuikeji.delivery.backstage.entity.TCustomer;
import com.bohuikeji.frame.module.admin.annotation.TableKeyField;
import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import com.bohuikeji.frame.module.admin.annotation.TableQueryField;
import com.bohuikeji.frame.module.admin.annotation.TableShowField;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.bohuikeji.frame.module.admin.entity.web.block.FileBlock;
import com.bohuikeji.frame.module.admin.entity.web.block.TextBlock;
import com.bohuikeji.frame.module.admin.enums.ColumnTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 领取优惠卷记录
 * </p>
 *
 * @author zhouliwu
 * @since 2021-03-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TDiscountRecord对象", description="发放代金券")
@TableName("t_discount_record")
public class TDiscountRecord extends EntityBase<TDiscountRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * 发放代金券id
     */
    @ApiModelProperty(value="发放代金券id")
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false)
    @TableId(value = "release_id", type = IdType.AUTO)
    private Integer releaseId;
    /**
     * 优惠券
     */
    @ApiModelProperty(value = "优惠券")
    @TableQueryField(show = false)
    @TableShowField(value = "优惠券")
    @TableNewField
    @TableField("dis_id")
    @TableKeyField(table = "t_discount_mall",keyShowFields = "dis_name",keyLikeFields = "dis_name",key = TDiscountMall.class)
    private Integer disId;
    /**
     * 领取客户
     */
    @ApiModelProperty(value = "领取客户")
    @TableQueryField(show = true)
    @TableShowField(value = "领取客户")
    @TableNewField
    @TableField("customer_id")
    @TableKeyField(table = "t_customer",keyShowFields = "customer_name",keyLikeFields = "customer_name",key = TCustomer.class)
    private Integer customerId;

    /**
     * 起始金额
     */
    @ApiModelProperty(value = "使用起始金额")
    @TableQueryField(show = false)
    @TableShowField(value = "使用起始金额")
    @TableNewField(required = false)
    @TableField("start_amount")
    private BigDecimal startAmount=new BigDecimal("0.00").setScale(2, BigDecimal.ROUND_DOWN);

    /**
     * 优惠面额
     */
    @ApiModelProperty(value = "优惠面额")
    @TableQueryField(show = false)
    @TableShowField(value = "优惠面额")
    @TableNewField
    @TableField("dis_value")
    private BigDecimal disValue=new BigDecimal("0.00").setScale(2, BigDecimal.ROUND_DOWN);


    /**
     * 领取时间
     */
    @ApiModelProperty(value = "领取时间")
    @TableQueryField(show = true)
    @TableShowField(value = "领取时间")
    @TableNewField(edit = false,show = false,required = false)
    @TableField("collection_time")
    private LocalDateTime collectionTime;

    /**
     * 使用时间
     */
    @ApiModelProperty(value = "使用时间")
    @TableQueryField(show = true)
    @TableShowField(value = "使用时间")
    @TableNewField(edit = false,show = false,required = false)
    @TableField("usage_time")
    private LocalDateTime usageTime;

    /**
     * 优惠卷类型
     */
    @ApiModelProperty(value = "优惠卷类型")
    @TableQueryField()
    @TableShowField(value = "优惠卷类型")
    @TableNewField(options = {"立减卷","满减卷","折扣卷","会员卡"},edit = false)
    @TableField("dis_type")
    private String disType;

    @ApiModelProperty(value = "发放类型（新客户卷、老客户卷）")
    @TableQueryField(show = false)
    @TableShowField(value = "发放类型")
    @TableNewField(options = {"全部","新客户","老客户"},edit = false)
    @TableField("grant_type")
    private String grantType;

    /**
     * 发放类型
     */
    @ApiModelProperty(value = "消费类型（急送、快递、跨城、拉货，会员）")
    @TableQueryField()
    @TableShowField(value = "发放类型")
    @TableNewField(options = {"会员","急送","快递","跨城","拉货"},edit = false)
    @TableField("cons_type")
    private String consType;

    /**
     * 使用状态
     */
    @ApiModelProperty(value = "领取类型")
    @TableQueryField(show = true)
    @TableShowField(value = "领取类型")
    @TableNewField(options = {"后台发放","免费赠送","充值发放"})
    @TableField("receive_method")
    private String receiveMethod;

    /**
     * 可用开始时间
     */
    @ApiModelProperty(value = "可用开始时间")
    @TableQueryField(show = true)
    @TableShowField(value = "可用开始时间")
    @TableNewField(show = false)
    @TableField("begin_date")
    private LocalDate beginDate;
    /**
     * 可用结束时间
     */
    @ApiModelProperty(value = "可用结束时间")
    @TableQueryField(show = true)
    @TableShowField(value = "可用结束时间")
    @TableNewField(show = false)
    @TableField("end_date")
    private LocalDate endDate;

    /**
     * 备注说明
     */
    @ApiModelProperty(value = "备注说明")
    @TableQueryField(show = false)
    @TableShowField(value = "备注说明")
    @TableNewField(block = TextBlock.class,required = false)
    @TableField("dis_remark")
    private String disRemark;

    /**
     * 使用说明
     */
    @ApiModelProperty(value = "使用说明")
    @TableQueryField(show = false)
    @TableShowField(value = "使用说明")
    @TableNewField(block = TextBlock.class,required = false)
    @TableField("use_explain")
    private String useExplain;

    /**
     * 使用状态
     */
    @ApiModelProperty(value = "使用状态")
    @TableQueryField(show = true)
    @TableShowField(value = "使用状态")
    @TableNewField
    @TableField("usage_status")
    private String usageStatus;

    /**
     * 使用说明
     */
    @ApiModelProperty(value = "优惠图片")
    @TableQueryField(show = false)
    @TableShowField(value = "优惠图片",type = ColumnTypeEnum.IMAGE)
    @TableNewField(block = FileBlock.class)
    @TableField("url_picture")
    private String urlPicture;
    /**
     * url优惠图标临时路径路径
     */
    @ApiModelProperty(value="url路径",name="url")
    @TableField(exist = false)
    private String urlone;

}
