package com.erp.order.client;

import com.erp.common.core.model.ApiResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;

@FeignClient(name = "finance-service", url = "${finance.service.url:http://finance-service}")
public interface FinanceClient {

    /**
     * 记录收款（订单支付成功后调用）
     */
    @PostMapping("/api/finance/income/record")
    ApiResponse<?> recordIncome(@RequestBody IncomeRecordRequest request);

    /**
     * 记录退款（订单退款时调用）
     */
    @PostMapping("/api/finance/refund/record")
    ApiResponse<?> recordRefund(@RequestBody RefundRecordRequest request);

    class IncomeRecordRequest {
        private String orderNo;
        private String shortId;
        private String platform;
        private Long shopId;
        private BigDecimal amount;
        private String paymentMethod;
        private String paymentTime;
        private String operator;

        public String getOrderNo() { return orderNo; }
        public void setOrderNo(String orderNo) { this.orderNo = orderNo; }
        public String getShortId() { return shortId; }
        public void setShortId(String shortId) { this.shortId = shortId; }
        public String getPlatform() { return platform; }
        public void setPlatform(String platform) { this.platform = platform; }
        public Long getShopId() { return shopId; }
        public void setShopId(Long shopId) { this.shopId = shopId; }
        public BigDecimal getAmount() { return amount; }
        public void setAmount(BigDecimal amount) { this.amount = amount; }
        public String getPaymentMethod() { return paymentMethod; }
        public void setPaymentMethod(String paymentMethod) { this.paymentMethod = paymentMethod; }
        public String getPaymentTime() { return paymentTime; }
        public void setPaymentTime(String paymentTime) { this.paymentTime = paymentTime; }
        public String getOperator() { return operator; }
        public void setOperator(String operator) { this.operator = operator; }
    }

    class RefundRecordRequest {
        private String orderNo;
        private String shortId;
        private BigDecimal refundAmount;
        private String refundReason;
        private String refundTime;
        private String operator;

        public String getOrderNo() { return orderNo; }
        public void setOrderNo(String orderNo) { this.orderNo = orderNo; }
        public String getShortId() { return shortId; }
        public void setShortId(String shortId) { this.shortId = shortId; }
        public BigDecimal getRefundAmount() { return refundAmount; }
        public void setRefundAmount(BigDecimal refundAmount) { this.refundAmount = refundAmount; }
        public String getRefundReason() { return refundReason; }
        public void setRefundReason(String refundReason) { this.refundReason = refundReason; }
        public String getRefundTime() { return refundTime; }
        public void setRefundTime(String refundTime) { this.refundTime = refundTime; }
        public String getOperator() { return operator; }
        public void setOperator(String operator) { this.operator = operator; }
    }
}
