package com.ff.weijinxiao.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ff.weijinxiao.util.jsonfilter.DateSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * 会员套餐
 */
@Data
@Entity
@Table(name = "tb_member_package")
public class MemberPackage implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int COMMENT '主键'")
    private Integer id;

    @Column(name = "title", columnDefinition = "varchar(30) COMMENT '套餐标题'")
    @ApiModelProperty(value = "套餐标题")
    private String title;

    @Column(name = "content", columnDefinition = "text COMMENT '套餐描述'")
    @ApiModelProperty(value = "套餐描述")
    private String content;

    @Column(name = "package_num", columnDefinition = "int COMMENT '套餐记账人数'")
    @ApiModelProperty(value = "套餐记账人数")
    private Integer packageNum = 1;

    @Column(name = "package_type", columnDefinition = "int COMMENT '套餐人数模式 1=固定人数 2=自定义人数'")
    @ApiModelProperty(value = "套餐人数模式 1=固定人数 2=自定义人数")
    private Integer packageType = 1;

    @Column(name = "for_new_member", columnDefinition = "int COMMENT '新会员自定义套餐 1=是 0=否 '")
    @ApiModelProperty(value = "新会员自定义套餐 1=是 0=否")
    private Integer forNewMember = 1;

    @Column(name = "one_year_price", columnDefinition = "decimal(10,2) COMMENT '套餐一年价格 套餐人数模式=1时有效'")
    @ApiModelProperty(value = "套餐一年价格 套餐人数模式=1时有效")
    private BigDecimal oneYearPrice;

    @Column(name = "two_year_price", columnDefinition = "decimal(10,2) COMMENT '套餐两年价格 套餐人数模式=1时有效'")
    @ApiModelProperty(value = "套餐两年价格 套餐人数模式=1时有效")
    private BigDecimal twoYearPrice;

    @Column(name = "three_year_price", columnDefinition = "decimal(10,2) COMMENT '套餐三年价格 套餐人数模式=1时有效'")
    @ApiModelProperty(value = "套餐三年价格 套餐人数模式=1时有效")
    private BigDecimal threeYearPrice;

    @Column(name = "current_price", columnDefinition = "decimal(10,2) COMMENT '现价/每人 套餐人数模式=2=自定义人数时有效'")
    @ApiModelProperty(value = "现价/每人 套餐人数模式=2=自定义人数时有效")
    private BigDecimal currentPrice;

    @Column(name = "original_price", columnDefinition = "decimal(10,2) COMMENT '原价/每人 套餐人数模式=2=自定义人数时有效'")
    @ApiModelProperty(value = "原价/每人 套餐人数模式=2=自定义人数时有效")
    private BigDecimal originalPrice;

    @Column(name = "is_delete", columnDefinition = "int COMMENT '是否是删除状态(0:否；1:是)'")
    @ApiModelProperty(value = "是否是删除状态(0:否；1:是)")
    private Integer isDelete = 0;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//json序列化实体类处理
    private Date createTime;

    @Column(name = "modify_time")
    @ApiModelProperty(value = "更新时间")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//json序列化实体类处理
    private Date modifyTime;

}
