package com.erp.waybill.express;

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

/**
 * 快递适配器接口 - 抽象各快递公司API
 */
public interface ExpressAdapter {

    /**
     * 获取快递编码（如：SF、YTO、ZTO）
     */
    String getCode();

    /**
     * 申请电子面单
     */
    ApplyResult applyWaybill(ApplyParams params);

    /**
     * 取消电子面单
     */
    boolean cancelWaybill(String waybillNo);

    /**
     * 查询运单状态
     */
    TrackResult queryStatus(String waybillNo);

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    class ApplyParams {
        private Long orderId;
        private String receiverName;
        private String receiverPhone;
        private String receiverAddress;
        private String senderName;
        private String senderPhone;
        private String senderAddress;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    class ApplyResult {
        private String expressCode;
        private String waybillNo;
        private String printContent;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    class TrackResult {
        private String status;
        private String location;
        private String description;
        private String signedTime;
        private String receiverName;
        private String receiverPhone;
    }
}
