package com.jeesharp.business.modules.finance.profitsharing.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.jeesharp.framework.mybatis.core.dataobject.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 微信分账回退单实体，映射表 {@code biz_profit_sharing_return}。
 *
 * @author jeesharp
 * @since 2026-06-11
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("biz_profit_sharing_return")
@Schema(description = "微信分账回退单")
public class ProfitSharingReturn extends BaseEntity<ProfitSharingReturn> {

    @Schema(description = "平台回退单号")
    private String returnNo;

    @Schema(description = "商户回退单号")
    private String outReturnNo;

    @Schema(description = "关联分账单ID")
    private String profitSharingOrderId;

    @Schema(description = "关联退款单ID")
    private String payRefundOrderId;

    @Schema(description = "商城子订单ID")
    private String mallOrderId;

    @Schema(description = "二级商户号")
    private String subMchId;

    @Schema(description = "原商户分账单号")
    private String sharingNo;

    @Schema(description = "微信分账单号")
    private String wxOrderId;

    @Schema(description = "微信 transaction_id")
    private String transactionId;

    @Schema(description = "回退商户号")
    private String returnMchId;

    @Schema(description = "回退金额（分）")
    private Integer returnAmountFen;

    /**
     * @see com.jeesharp.business.modules.finance.profitsharing.enums.ProfitSharingReturnStatusEnum
     */
    @Schema(description = "回退状态")
    private String status;

    @Schema(description = "微信回退单号")
    private String wxReturnNo;

    @Schema(description = "微信回退结果")
    private String wxResult;

    @Schema(description = "失败原因")
    private String failReason;

    @Schema(description = "回退成功时间")
    private LocalDateTime returnTime;

    @Schema(description = "重试次数")
    private Integer retryCount;

    @Schema(description = "下次重试时间")
    private LocalDateTime nextRetryTime;

    @Schema(description = "渠道错误码")
    private String errorCode;

    @Schema(description = "渠道错误说明")
    private String errorMsg;

    @Schema(description = "回退描述")
    private String description;

    @Schema(description = "渠道请求原文")
    private String rawRequest;

    @Schema(description = "渠道响应原文")
    private String rawResponse;
}
