package com.ssm.manage.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.*;

@Table(name = "recharge_type")
public class RechargeType implements Serializable {

    @Getter
    @Setter
    private List<PromotionProject> promotionProjectList;

    /**
     * 主键ID
     */
    @Id
    private Long id;

    /**
     * 编码
     */
    @Column(name = "recharge_type_num")
    @ExcelProperty("充值编码*")
    private String rechargeTypeNum;

    /**
     * 名称
     */
    @Column(name = "recharge_type_name")
    @ExcelProperty("充值名称*")
    private String rechargeTypeName;

    /**
     * 门店编码
     */
    @Column(name = "store_id")
    private Long storeId;

    /**
     * 门店名称
     */
    @Column(name = "store_name")
    private String storeName;

    /**
     * 享受优惠
     */
    @ExcelProperty("享受折扣(%)")
    private BigDecimal discount;

    /**
     * 状态 1:使用/0：停用
     */
    @ExcelProperty("状态*")
    private Integer state;

    /**
     * 提成  小于1表示比率，大于等于1表示固定金额
     */
    @Column(name = "type_ratio")
    @ExcelProperty("充值提成*")
    private BigDecimal typeRatio;

    /**
     * 类别 1:折扣卡类型/0:赠送卡类型/2：促销卡类型
     */
    @ExcelProperty("充值类别*")
    private Integer type;

    /**
     * 类别充值金额
     */
    @Column(name = "recharge_money")
    @ExcelProperty("充值金额*")
    private BigDecimal rechargeMoney;

    /**
     * 赠送卡赠送金额
     */
    @Column(name = "gift_money")
    @ExcelProperty("赠送金额")
    private BigDecimal giftMoney;

    /**
     * 建立人（用户名称（用户编码）），来源于员工档案
     */
    @Column(name = "founder_staff")
    private String founderStaff;

    /**
     * 建立日期
     */
    @Column(name = "Founder_datetime")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date founderDatetime;

    /**
     * 最近修改人（用户名称（用户编码）），来源于员工档案
     */
    @Column(name = "modify_by")
    private String modifyBy;

    /**
     * 最近修改时间
     */
    @Column(name = "modify_datetime")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date modifyDatetime;

    /**
     * 有效期 单位:月
     */
    @Column(name = "valid_time")
    @ExcelProperty("有效日期")
    private Integer validTime;

    private static final long serialVersionUID = 1L;


    /**
     * 赠送金额使用折扣
     */
    @Column(name = "discount_free_amount")
    private BigDecimal discountFreeAmount;


    /**
     * 促销开始日期
     */
    @Column(name = "start_dates")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startDates;

    /**
     * 促销结束日期
     */
    @Column(name = "stop_dates")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date stopDates;


    /**
     * 充值金额占比
     */
    @Column(name = "recharge_bl")
    private BigDecimal rechargeBl;

    /**
     * 赠送金额占比
     */
    @Column(name = "free_of")
    private BigDecimal freeOf;

    /**
     * 首充金额
     */
    @Column(name = "first_amount")
    private BigDecimal firstAmount;
    /**
     * 0=正常卡，1=升级级关系卡
     */
    @Column(name = "card_type")
    private Integer cardType;

    /**
     * 升降级卡对应ID
     */
    @Column(name = "lift_card_id")
    private Long liftCardId;



    /**
     * 升降级卡对应ID
     */
    @Column(name = "raw_card_id")
    private Long rawCardId;

    /**
     * 升降级类型（0=升级，1=降级）
     */
    @Column(name = "lift_type")
    private Integer liftType;


    @Column(name = "unified_due")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private String unifiedDue;

    /**
     * 0=固定赠送，1=比例赠送
     */
    @Column(name = "donate_type")
    private Integer donateType;

    /**
     * 赠送卡是否限制门店使用（1限制门店使用，0不限制门店使用）
     */
    @Column(name = "give_type")
    private Integer giveType;

    /**
     * 是否指定门店使用(0否，1是)
     */
    @Column(name = "store_type")
    private Integer storeType;

    List<RechargeTypeStore> rechargeTypeStoreList;

    public List<RechargeTypeStore> getRechargeTypeStoreList() {
        return rechargeTypeStoreList;
    }

    public void setRechargeTypeStoreList(List<RechargeTypeStore> rechargeTypeStoreList) {
        this.rechargeTypeStoreList = rechargeTypeStoreList;
    }

    public Integer getStoreType() {
        return storeType;
    }

    public void setStoreType(Integer storeType) {
        this.storeType = storeType;
    }

    public Integer getGiveType() {
        return giveType;
    }

    public void setGiveType(Integer giveType) {
        this.giveType = giveType;
    }

    public Integer getDonateType() {
        return donateType;
    }

    public void setDonateType(Integer donateType) {
        this.donateType = donateType;
    }

    public BigDecimal getRechargeBl() {
        return rechargeBl;
    }

    public void setRechargeBl(BigDecimal rechargeBl) {
        this.rechargeBl = rechargeBl;
    }

    public BigDecimal getFreeOf() {
        return freeOf;
    }

    public void setFreeOf(BigDecimal freeOf) {
        this.freeOf = freeOf;
    }

    public String getUnifiedDue() {
        return unifiedDue;
    }

    public void setUnifiedDue(String unifiedDue) {
        this.unifiedDue = unifiedDue;
    }

    public Integer getLiftType() {
        return liftType;
    }

    public void setLiftType(Integer liftType) {
        this.liftType = liftType;
    }

    /**
     * 获取主键ID
     *
     * @return id - 主键ID
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置主键ID
     *
     * @param id 主键ID
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 获取编码
     *
     * @return recharge_type_num - 编码
     */
    public String getRechargeTypeNum() {
        return rechargeTypeNum;
    }

    /**
     * 设置编码
     *
     * @param rechargeTypeNum 编码
     */
    public void setRechargeTypeNum(String rechargeTypeNum) {
        this.rechargeTypeNum = rechargeTypeNum;
    }

    /**
     * 获取名称
     *
     * @return recharge_type_name - 名称
     */
    public String getRechargeTypeName() {
        return rechargeTypeName;
    }

    /**
     * 设置名称
     *
     * @param rechargeTypeName 名称
     */
    public void setRechargeTypeName(String rechargeTypeName) {
        this.rechargeTypeName = rechargeTypeName;
    }

    /**
     * 获取门店编码
     *
     * @return store_id - 门店编码
     */
    public Long getStoreId() {
        return storeId;
    }

    /**
     * 设置门店编码
     *
     * @param storeId 门店编码
     */
    public void setStoreId(Long storeId) {
        this.storeId = storeId;
    }

    /**
     * 获取门店名称
     *
     * @return store_name - 门店名称
     */
    public String getStoreName() {
        return storeName;
    }

    /**
     * 设置门店名称
     *
     * @param storeName 门店名称
     */
    public void setStoreName(String storeName) {
        this.storeName = storeName;
    }

    /**
     * 获取享受优惠
     *
     * @return discount - 享受优惠
     */
    public BigDecimal getDiscount() {
        return discount;
    }

    /**
     * 设置享受优惠
     *
     * @param discount 享受优惠
     */
    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    /**
     * 获取状态 1:使用/0：停用
     *
     * @return state - 状态 1:使用/0：停用
     */
    public Integer getState() {
        return state;
    }

    /**
     * 设置状态 1:使用/0：停用
     *
     * @param state 状态 1:使用/0：停用
     */
    public void setState(Integer state) {
        this.state = state;
    }

    /**
     * 获取提成  小于1表示比率，大于等于1表示固定金额
     *
     * @return type_ratio - 提成  小于1表示比率，大于等于1表示固定金额
     */
    public BigDecimal getTypeRatio() {
        return typeRatio;
    }

    /**
     * 设置提成  小于1表示比率，大于等于1表示固定金额
     *
     * @param typeRatio 提成  小于1表示比率，大于等于1表示固定金额
     */
    public void setTypeRatio(BigDecimal typeRatio) {
        this.typeRatio = typeRatio;
    }

    /**
     * 获取类别 1:折扣卡类型/0:赠送卡类型
     *
     * @return type - 类别 1:折扣卡类型/0:赠送卡类型
     */
    public Integer getType() {
        return type;
    }

    /**
     * 设置类别 1:折扣卡类型/0:赠送卡类型
     *
     * @param type 类别 1:折扣卡类型/0:赠送卡类型
     */
    public void setType(Integer type) {
        this.type = type;
    }

    /**
     * 获取类别充值金额
     *
     * @return recharge_money - 类别充值金额
     */
    public BigDecimal getRechargeMoney() {
        return rechargeMoney;
    }

    /**
     * 设置类别充值金额
     *
     * @param rechargeMoney 类别充值金额
     */
    public void setRechargeMoney(BigDecimal rechargeMoney) {
        this.rechargeMoney = rechargeMoney;
    }

    /**
     * 获取赠送卡赠送金额
     *
     * @return gift_money - 赠送卡赠送金额
     */
    public BigDecimal getGiftMoney() {
        return giftMoney;
    }

    /**
     * 设置赠送卡赠送金额
     *
     * @param giftMoney 赠送卡赠送金额
     */
    public void setGiftMoney(BigDecimal giftMoney) {
        this.giftMoney = giftMoney;
    }

    /**
     * 获取建立人（用户名称（用户编码）），来源于员工档案
     *
     * @return founder_staff - 建立人（用户名称（用户编码）），来源于员工档案
     */
    public String getFounderStaff() {
        return founderStaff;
    }

    /**
     * 设置建立人（用户名称（用户编码）），来源于员工档案
     *
     * @param founderStaff 建立人（用户名称（用户编码）），来源于员工档案
     */
    public void setFounderStaff(String founderStaff) {
        this.founderStaff = founderStaff;
    }

    /**
     * 获取建立日期
     *
     * @return Founder_datetime - 建立日期
     */
    public Date getFounderDatetime() {
        return founderDatetime;
    }

    /**
     * 设置建立日期
     *
     * @param founderDatetime 建立日期
     */
    public void setFounderDatetime(Date founderDatetime) {
        this.founderDatetime = founderDatetime;
    }

    /**
     * 获取最近修改人（用户名称（用户编码）），来源于员工档案
     *
     * @return modify_by - 最近修改人（用户名称（用户编码）），来源于员工档案
     */
    public String getModifyBy() {
        return modifyBy;
    }

    /**
     * 设置最近修改人（用户名称（用户编码）），来源于员工档案
     *
     * @param modifyBy 最近修改人（用户名称（用户编码）），来源于员工档案
     */
    public void setModifyBy(String modifyBy) {
        this.modifyBy = modifyBy;
    }

    /**
     * 获取最近修改时间
     *
     * @return modify_datetime - 最近修改时间
     */
    public Date getModifyDatetime() {
        return modifyDatetime;
    }

    /**
     * 设置最近修改时间
     *
     * @param modifyDatetime 最近修改时间
     */
    public void setModifyDatetime(Date modifyDatetime) {
        this.modifyDatetime = modifyDatetime;
    }

    /**
     * 获取有效期 单位:月
     *
     * @return valid_time - 有效期 单位:月
     */
    public Integer getValidTime() {
        return validTime;
    }

    /**
     * 设置有效期 单位:月
     *
     * @param validTime 有效期 单位:月
     */
    public void setValidTime(Integer validTime) {
        this.validTime = validTime;
    }

    public Date getStartDates() {
        return startDates;
    }

    public void setStartDates(Date startDates) {
        this.startDates = startDates;
    }

    public Date getStopDates() {
        return stopDates;
    }

    public void setStopDates(Date stopDates) {
        this.stopDates = stopDates;
    }

    public BigDecimal getDiscountFreeAmount() {
        return discountFreeAmount;
    }

    public void setDiscountFreeAmount(BigDecimal discountFreeAmount) {
        this.discountFreeAmount = discountFreeAmount;
    }

    public BigDecimal getFirstAmount() {
        return firstAmount;
    }

    public void setFirstAmount(BigDecimal firstAmount) {
        this.firstAmount = firstAmount;
    }

    public Integer getCardType() {
        return cardType;
    }

    public void setCardType(Integer cardType) {
        this.cardType = cardType;
    }

    public Long getLiftCardId() {
        return liftCardId;
    }

    public void setLiftCardId(Long liftCardId) {
        this.liftCardId = liftCardId;
    }

    public Long getRawCardId() {
        return rawCardId;
    }

    public void setRawCardId(Long rawCardId) {
        this.rawCardId = rawCardId;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        RechargeType other = (RechargeType) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getRechargeTypeNum() == null ? other.getRechargeTypeNum() == null : this.getRechargeTypeNum().equals(other.getRechargeTypeNum()))
            && (this.getRechargeTypeName() == null ? other.getRechargeTypeName() == null : this.getRechargeTypeName().equals(other.getRechargeTypeName()))
            && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()))
            && (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName()))
            && (this.getDiscount() == null ? other.getDiscount() == null : this.getDiscount().equals(other.getDiscount()))
            && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
            && (this.getTypeRatio() == null ? other.getTypeRatio() == null : this.getTypeRatio().equals(other.getTypeRatio()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getRechargeMoney() == null ? other.getRechargeMoney() == null : this.getRechargeMoney().equals(other.getRechargeMoney()))
            && (this.getGiftMoney() == null ? other.getGiftMoney() == null : this.getGiftMoney().equals(other.getGiftMoney()))
            && (this.getFounderStaff() == null ? other.getFounderStaff() == null : this.getFounderStaff().equals(other.getFounderStaff()))
            && (this.getFounderDatetime() == null ? other.getFounderDatetime() == null : this.getFounderDatetime().equals(other.getFounderDatetime()))
            && (this.getModifyBy() == null ? other.getModifyBy() == null : this.getModifyBy().equals(other.getModifyBy()))
            && (this.getModifyDatetime() == null ? other.getModifyDatetime() == null : this.getModifyDatetime().equals(other.getModifyDatetime()))
            && (this.getValidTime() == null ? other.getValidTime() == null : this.getValidTime().equals(other.getValidTime()))
            && (this.getStartDates() == null ? other.getStartDates() == null : this.getStartDates().equals(other.getStartDates()))
            && (this.getStopDates() == null ? other.getStopDates() == null : this.getStopDates().equals(other.getStopDates()))
            && (this.getFirstAmount() == null ? other.getFirstAmount() == null : this.getFirstAmount().equals(other.getFirstAmount()))
            && (this.getLiftCardId() == null ? other.getLiftCardId() == null : this.getLiftCardId().equals(other.getLiftCardId()))
            && (this.getCardType() == null ? other.getCardType() == null : this.getCardType().equals(other.getCardType()))
            && (this.getGiveType() == null ? other.getGiveType() == null : this.getGiveType().equals(other.getGiveType()))
            && (this.getDiscountFreeAmount() == null ? other.getDiscountFreeAmount() == null : this.getDiscountFreeAmount().equals(other.getDiscountFreeAmount()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getRechargeTypeNum() == null) ? 0 : getRechargeTypeNum().hashCode());
        result = prime * result + ((getRechargeTypeName() == null) ? 0 : getRechargeTypeName().hashCode());
        result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
        result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode());
        result = prime * result + ((getDiscount() == null) ? 0 : getDiscount().hashCode());
        result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
        result = prime * result + ((getTypeRatio() == null) ? 0 : getTypeRatio().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getRechargeMoney() == null) ? 0 : getRechargeMoney().hashCode());
        result = prime * result + ((getGiftMoney() == null) ? 0 : getGiftMoney().hashCode());
        result = prime * result + ((getFounderStaff() == null) ? 0 : getFounderStaff().hashCode());
        result = prime * result + ((getFounderDatetime() == null) ? 0 : getFounderDatetime().hashCode());
        result = prime * result + ((getModifyBy() == null) ? 0 : getModifyBy().hashCode());
        result = prime * result + ((getModifyDatetime() == null) ? 0 : getModifyDatetime().hashCode());
        result = prime * result + ((getValidTime() == null) ? 0 : getValidTime().hashCode());
        result = prime * result + ((getStartDates() == null) ? 0 : getStartDates().hashCode());
        result = prime * result + ((getStopDates() == null) ? 0 : getStopDates().hashCode());
        result = prime * result + ((getDiscountFreeAmount() == null) ? 0 : getDiscountFreeAmount().hashCode());
        result = prime * result + ((getFirstAmount() == null) ? 0 : getFirstAmount().hashCode());
        result = prime * result + ((getCardType() == null) ? 0 : getCardType().hashCode());
        result = prime * result + ((getGiveType() == null) ? 0 : getGiveType().hashCode());
        result = prime * result + ((getLiftCardId() == null) ? 0 : getLiftCardId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", rechargeTypeNum=").append(rechargeTypeNum);
        sb.append(", rechargeTypeName=").append(rechargeTypeName);
        sb.append(", storeId=").append(storeId);
        sb.append(", storeName=").append(storeName);
        sb.append(", discount=").append(discount);
        sb.append(", state=").append(state);
        sb.append(", typeRatio=").append(typeRatio);
        sb.append(", type=").append(type);
        sb.append(", rechargeMoney=").append(rechargeMoney);
        sb.append(", giftMoney=").append(giftMoney);
        sb.append(", founderStaff=").append(founderStaff);
        sb.append(", founderDatetime=").append(founderDatetime);
        sb.append(", modifyBy=").append(modifyBy);
        sb.append(", modifyDatetime=").append(modifyDatetime);
        sb.append(", validTime=").append(validTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append(", startDates=").append(startDates);
        sb.append(", stopDates=").append(stopDates);
        sb.append(", discountFreeAmount=").append(discountFreeAmount);
        sb.append(", firstAmount=").append(firstAmount);
        sb.append(", cardType=").append(cardType);
        sb.append(", cardType=").append(cardType);
        sb.append(", giveType=").append(giveType);
        sb.append("]");
        return sb.toString();
    }
}