package shop.alien.entity.store;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * <p>
 * 退款记录表
 * </p>
 *
 * @author system
 * @since 2025-01-XX
 */
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude
@ApiModel(value = "RefundRecord对象", description = "退款记录表")
@TableName("refund_record")
public class RefundRecord extends Model<RefundRecord> {

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "用户ID")
    @TableField("user_id")
    private Integer userId;

    @ApiModelProperty(value = "商户订单号：商户系统生成的原交易订单唯一标识")
    @TableField("out_trade_no")
    private String outTradeNo;

    @ApiModelProperty(value = "第三方支付订单号：微信支付订单号或支付宝交易号")
    @TableField("transaction_id")
    private String transactionId;

    @ApiModelProperty(value = "商户退款单号：商户系统生成的退款单号")
    @TableField("out_refund_no")
    private String outRefundNo;

    @ApiModelProperty(value = "第三方退款单号：微信退款单号或支付宝退款单号")
    @TableField("refund_id")
    private String refundId;

    @ApiModelProperty(value = "支付类型：WECHAT_PAY-微信支付, ALIPAY-支付宝")
    @TableField("pay_type")
    private String payType;

    @ApiModelProperty(value = "退款状态：SUCCESS-退款成功, CLOSED-退款关闭, PROCESSING-退款处理中, ABNORMAL-退款异常, FAIL-退款失败")
    @TableField("refund_status")
    private String refundStatus;

    @ApiModelProperty(value = "订单总金额：单位分")
    @TableField("total_amount")
    private Long totalAmount;

    @ApiModelProperty(value = "退款金额：单位分")
    @TableField("refund_amount")
    private Long refundAmount;

    @ApiModelProperty(value = "实际退款金额：单位分，最终成功退回给用户的金额")
    @TableField("actual_refund_amount")
    private Long actualRefundAmount;

    @ApiModelProperty(value = "退款币种：默认CNY")
    @TableField("currency")
    private String currency;

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

    @ApiModelProperty(value = "退款渠道：ORIGINAL-原路退回, BALANCE-退回余额, OTHER_BALANCE-其他余额, OTHER_BANKCARD-其他银行卡")
    @TableField("refund_channel")
    private String refundChannel;

    @ApiModelProperty(value = "退款资金来源：AVAILABLE-可用余额, UNSETTLED-未结算资金")
    @TableField("funds_account")
    private String fundsAccount;

    @ApiModelProperty(value = "退款创建时间：退款请求创建时间")
    @TableField("refund_create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date refundCreateTime;

    @ApiModelProperty(value = "退款成功时间：退款成功完成时间")
    @TableField("refund_success_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date refundSuccessTime;

    @ApiModelProperty(value = "用户收到退款账户：退款到账的账户信息")
    @TableField("user_received_account")
    private String userReceivedAccount;

    @ApiModelProperty(value = "退款详情：退款渠道明细列表（JSON格式）")
    @TableField("refund_detail")
    private String refundDetail;

    @ApiModelProperty(value = "错误码：退款失败时的错误码")
    @TableField("error_code")
    private String errorCode;

    @ApiModelProperty(value = "错误信息：退款失败时的错误描述")
    @TableField("error_msg")
    private String errorMsg;

    @ApiModelProperty(value = "响应数据：第三方支付平台返回的完整响应数据（JSON格式）")
    @TableField("response_data")
    private String responseData;

    @ApiModelProperty(value = "业务订单ID：关联的业务订单ID")
    @TableField("order_id")
    private String orderId;

    @ApiModelProperty(value = "店铺ID")
    @TableField("store_id")
    private Integer storeId;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @ApiModelProperty(value = "创建人ID")
    @TableField("created_user_id")
    private Integer createdUserId;

    @ApiModelProperty(value = "修改时间")
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @ApiModelProperty(value = "修改人ID")
    @TableField("updated_user_id")
    private Integer updatedUserId;
}

