package com.multictrl.modules.business.dto.camera;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * 变焦参数
 *
 * @author Sdy
 * @since 1.0.0 2026/4/28
 */
@Data
@Schema(name = "变焦参数")
public class FocalLengthSet {
    //    @NotBlank(message = "相机模式不能为空")
    @Schema(description = "相机模式 ir:红外 wide:广角 zoom:变焦", hidden = true)
    private String cameraType;

    @NotNull(message = "变焦倍数不能为空")
    @Schema(description = "变焦倍数，可见光是2-200，红外是2-20")
    private Double zoomFactor;

    @JsonIgnore
    @Schema(hidden = true)
    @AssertTrue(message = "变焦倍数设置错误")
    public boolean isZoomFactorValid() {
        if (cameraType.equals("ir")) {
            return 2 <= zoomFactor && zoomFactor <= 20;
        } else {
            return 2 <= zoomFactor && zoomFactor <= 200;
        }
    }
}
