package cn.ysk.cashier.pojo.order;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.math.BigDecimal;
import java.io.Serializable;

@Entity
@Data
@Table(name = "tb_group_order_coupon")
public class TbGroupOrderCoupon implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`order_id`", nullable = false)
    @ApiModelProperty(value = "团购订单id")
    private Integer orderId;

    @Column(name = "`coupon_no`", nullable = false)
    @ApiModelProperty(value = "团购卷码")
    private String couponNo;

    @Column(name = "`is_refund`", nullable = false)
    @ApiModelProperty(value = "是否已退款 0：否 1：是")
    private Integer isRefund;

    @Column(name = "`refund_amount`")
    @ApiModelProperty(value = "退款金额")
    private BigDecimal refundAmount;

    @Column(name = "`refund_reason`")
    @ApiModelProperty(value = "退款原因")
    private String refundReason;

    @Column(name = "`refund_desc`")
    @ApiModelProperty(value = "退款说明")
    private String refundDesc;

    public void copy(TbGroupOrderCoupon source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
