package com.battery.device.api.model; import java.math.BigDecimal; import java.util.Objects; /** 设备返回的计划工步,只用于观测和展示,不属于测试配置。 */ public record PlannedStep(int stepNo, String stepType, String name, BigDecimal targetVoltageV, BigDecimal targetCurrentA, Long durationSeconds) { public PlannedStep { if (stepNo < 1) throw new IllegalArgumentException("stepNo must be positive"); stepType = Objects.requireNonNull(stepType, "stepType").trim(); if (stepType.isEmpty()) throw new IllegalArgumentException("stepType must not be blank"); name = name == null ? null : name.trim(); if (durationSeconds != null && durationSeconds < 0) throw new IllegalArgumentException("durationSeconds must be non-negative"); } }