/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package cn.ysk.cashier.pojo;

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 javax.validation.constraints.*;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2023-11-07
**/
@Entity
@Data
@Table(name="tb_renewals_pay_log")
public class TbRenewalsPayLog implements Serializable {

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

    @Column(name = "`pay_type`")
    @ApiModelProperty(value = "支付方式")
    private String payType;

    @Column(name = "`shop_id`")
    @ApiModelProperty(value = "店铺Id")
    private String shopId;

    @Column(name = "`order_id`")
    @ApiModelProperty(value = "订单Id")
    private String orderId;

    @Column(name = "`open_id`")
    @ApiModelProperty(value = "openId")
    private String openId;

    @Column(name = "`user_id`")
    @ApiModelProperty(value = "用户Id")
    private String userId;

    @Column(name = "`transaction_id`")
    @ApiModelProperty(value = "交易单号（第三方交易单号）")
    private String transactionId;

    @Column(name = "`amount`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "金额")
    private BigDecimal amount;

    @Column(name = "`status`")
    @ApiModelProperty(value = "状态 ")
    private Integer status;

    @Column(name = "`remark`")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "`attach`")
    @ApiModelProperty(value = "用户自定义参数")
    private String attach;

    @Column(name = "`expired_at`")
    @ApiModelProperty(value = "到期时间")
    private Long expiredAt;

    @Column(name = "`created_at`")
    @ApiModelProperty(value = "创建时间")
    private Long createdAt;

    @Column(name = "`updated_at`")
    @ApiModelProperty(value = "updatedAt")
    private Long updatedAt;

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