package com.jeesharp.business.modules.finance.payorder.dto;

import com.jeesharp.framework.pojo.dto.BaseSaveDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 支付单后台保存 DTO，用于补录或运维修正；C 端发起支付请走应用服务专用方法。
 *
 * @author jeesharp
 * @since 2026-05-08
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "支付单保存")
public class PayOrderSaveDTO extends BaseSaveDTO {

    @NotBlank(message = "业务场景不能为空")
    @Schema(description = "业务场景编码", requiredMode = Schema.RequiredMode.REQUIRED)
    private String bizScene;

    @NotBlank(message = "业务订单ID不能为空")
    @Schema(description = "业务订单主键", requiredMode = Schema.RequiredMode.REQUIRED)
    private String bizOrderId;

    @NotBlank(message = "商户支付单号不能为空")
    @Schema(description = "商户侧支付单号", requiredMode = Schema.RequiredMode.REQUIRED)
    private String outTradeNo;

    @Schema(description = "微信 prepay_id")
    private String prepayId;

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

    @NotNull(message = "金额不能为空")
    @Schema(description = "应付金额（元）", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal payAmount;

    @Schema(description = "支付单状态")
    private Integer payStatus;

    @Schema(description = "会员ID")
    private String memberId;

    @Schema(description = "标题")
    private String subject;

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

    @Schema(description = "异步通知地址")
    private String notifyUrl;

    @Schema(description = "渠道用户 openid")
    private String channelUserId;

    @Schema(description = "支付渠道")
    private String payChannel;

    @Schema(description = "支付类型编码")
    private String payType;

    @Schema(description = "支付成功时间")
    private LocalDateTime payTime;

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

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