package com.ruoyi.app.order.dto;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
public class AdminOrderActionRequest {

    @NotNull(message = "订单状态快照不能为空")
    @Min(value = 0, message = "订单状态无效")
    @Max(value = 4, message = "订单状态无效")
    private Long expectedState;

    @Min(value = 0, message = "配送状态无效")
    @Max(value = 3, message = "配送状态无效")
    private Long expectedDeliveryStatus;

    @NotNull(message = "支付状态快照不能为空")
    @Min(value = 0, message = "支付状态无效")
    @Max(value = 2, message = "支付状态无效")
    private Long expectedPayStatus;

    @NotNull(message = "售后状态快照不能为空")
    @Min(value = 0, message = "售后状态无效")
    @Max(value = 6, message = "售后状态无效")
    private Long expectedAfterSaleStatus;

    @NotBlank(message = "请填写调整原因")
    @Size(max = 200, message = "调整原因不能超过200字")
    private String reason;

    public String normalizedReason() {
        return reason == null ? "" : reason.trim();
    }
}
