package com.erp.finance.dto;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.Builder;

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

/**
 * 统一财务API响应
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class FinanceApiResponse<T> {
    private int code;
    private T data;
    private String message;

    public static <T> FinanceApiResponse<T> success(T data) {
        return new FinanceApiResponse<>(200, data, "success");
    }

    public static <T> FinanceApiResponse<T> success(T data, String message) {
        return new FinanceApiResponse<>(200, data, message);
    }

    public static <T> FinanceApiResponse<T> error(int code, String message) {
        return new FinanceApiResponse<>(code, null, message);
    }

    public static <T> FinanceApiResponse<T> notFound(String message) {
        return new FinanceApiResponse<>(404, null, message);
    }

    public static <T> FinanceApiResponse<T> badRequest(String message) {
        return new FinanceApiResponse<>(400, null, message);
    }

    // ============== 内部请求类 ==============
    @lombok.Data
    @lombok.NoArgsConstructor
    @lombok.AllArgsConstructor
    public static class IncomeRecordRequest {
        /** 关联订单号 */
        private String orderNo;
        /** 平台短ID */
        private String shortId;
        /** 平台 */
        private String platform;
        /** 店铺ID */
        private Long shopId;
        /** 店铺名称 */
        private String shopName;
        /** 收款金额 */
        private java.math.BigDecimal amount;
        /** 优惠金额 */
        private java.math.BigDecimal discountAmount;
        /** 实际到账金额 */
        private java.math.BigDecimal actualAmount;
        /** 支付方式 */
        private String paymentMethod;
        /** 支付时间 */
        private String paymentTime;
        /** 支付流水号 */
        private String transactionId;
        /** 收款账户 */
        private String accountNo;
        /** 账户名称 */
        private String accountName;
        /** 备注 */
        private String remark;
    }
}
