package com.sonic.lion.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sonic.lion.enums.BizType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "apple_refund_record", autoResultMap = true)
public class AppleRefundRecord {

    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 产品ID
     */
    private String productId;

    /**
     * 业务类型
     */
    private BizType bizType;
    /**
     * 交易编号（第三方）
     */
    private String transactionId;

    /**
     * 争议Id
     */
    private String disputeId;
    /**
     * 购买时间
     */
    private LocalDateTime purchaseDate;
    /**
     * 退款时间
     */
    private LocalDateTime cancellationDate;
    /**
     * 交易单号
     */
    private String tradeNo;
    /**
     * 用户ID
     */
    private Long userId;
    /**
     * 购买数量
     */
    private Long buff;
    /**
     * 购买金额
     */
    private Long amount;

    /**
     * 平台
     */
    private Platform platform;


    /**
     * 第三方接口的原始内容
     */
    private String content;
    //冻结状态  扣减（还有余额） 冻结（没有余额 ）
    private FronzenStatus fronzenStatus;

    //冻结之后 的金额
    private Long afterFronzenBuff;


    public enum FronzenStatus {
        INIT, DEC, FRONZEN
    }

    public enum Platform {
        PAYPAL, IOS, GOOGLE, PAYMENTWALL, CHECKOUT, AIRWALLEX;
    }


    private String createTime;
    private String transactionTime;
    private String transactionStatus;
    @TableField(exist = false)
    private String currency="USD";
    private String buyerName;
    private String reason;
    private String status;

    @TableField(exist = false)
    private String sellerResponseDueDate;
    private String ip;
    private String email;
    private String nickname;
    private String idCard;
    private LocalDateTime registerTime;
    private LocalDateTime pstPayTime;

    /**
     *     [{"kind":"androidpublisher#voidedPurchase","purchaseTimeMillis":"1635348172211",
     *      * "purchaseToken":"doibnmclnepnigcblgnodkgo.AO-J1OyK0N8BkSeDyyMpQeOG-Z7jcadCTMxkINqXVPZWcpl91YOqVkaOkWS4OqGl3WHk1XAXwx6P8DNQwMxLrmxXLGnM0ULr7g",
     *     * "voidedTimeMillis":"1636432172312","orderId":"GPA.3327-1510-4846-05509","voidedSource":0,"voidedReason":7}]
     *
     */

    /**
     * 订单ID	购买商品名称	购买数量	购买金额	购买时间	退款时间	用户ID 订单号	客户端（GP/苹果/web）
     */


    /**
     * 数据插入时间
     */
    private LocalDateTime insertTime;
}
