package org.ta.pddserver.model.api.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Data
public class OutBoundRequest {

    @Schema(
            description = "运单号列表",
            example = "",
            defaultValue = "",
            requiredMode = Schema.RequiredMode.REQUIRED // 必填
    )
    private List<OutBoundList> outBound;

    @Schema(
            description = "集运单号",
            example = "P12345678",
            defaultValue = "",
            requiredMode = Schema.RequiredMode.REQUIRED // 必填
    )
    private String orderCode;

    @Schema(
            description = "订单信息列表",
            example = "",
            defaultValue = "",
            requiredMode = Schema.RequiredMode.REQUIRED // 必填
    )
    private List<OutPackage> outPackageList;

    @Schema(
            description = "异常原因编号",
            example = "103",
            defaultValue = "",
            requiredMode = Schema.RequiredMode.REQUIRED // 必填
    )
    private Result result;


    /**
     * 包裹详情
     */
    @Data
    public static class OutBoundList {
        @Schema(
                description = "运单号",
                example = "P12345678",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.REQUIRED // 必填
        )
        private String mailNo;


    }

    @Data
    public static class OutPackage {
        @Schema(
                description = "包裹长度，单位默认为厘米",
                example = "1",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.REQUIRED // 必填
        )
        private Long length;

        @Schema(
                description = "包裹宽度，单位默认为厘米",
                example = "1",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.REQUIRED // 必填
        )
        private Long width;

        @Schema(
                description = "包裹高度，单位默认为厘米",
                example = "1",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.REQUIRED // 必填
        )
        private Long height;

        @Schema(
                description = "实重重量，单位默认为克",
                example = "1",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.REQUIRED // 必填
        )
        private Long weight;

        @Schema(
                description = "包裹种类",
                example = "1",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.REQUIRED // 必填
        )
        private String packageType;

        @Schema(
                description = "运单号",
                example = "P1234567",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.REQUIRED // 必填
        )
        private String mailNo;

        @Schema(
                description = "快递公司编号",
                example = "SF",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.REQUIRED // 必填
        )
        private String expressCode;
    }

    @Data
    public static class Result {
        @Schema(
                description = "异常原因",
                example = "",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.NOT_REQUIRED // 必填
        )
        private String desc;

        @Schema(
                description = "异常备注",
                example = "",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.NOT_REQUIRED // 必填
        )
        private String remark;

        @Schema(
                description = "异常编号",
                example = "103",
                defaultValue = "",
                requiredMode = Schema.RequiredMode.NOT_REQUIRED // 必填
        )
        private int code;
    }

}
