package com.ruoyi.wcs.query; import java.time.Instant; import java.util.Objects; public final class RecoveryCaseView { private final String caseId; private final String deviceId; private final String commandKey; private final String state; private final String reason; private final Instant createdAt; private final String resolvedBy; private final Instant resolvedAt; public RecoveryCaseView(String caseId, String deviceId, String commandKey, String state, String reason, Instant createdAt, String resolvedBy, Instant resolvedAt) { this.caseId = requireText(caseId, "caseId"); this.deviceId = requireText(deviceId, "deviceId"); this.commandKey = requireText(commandKey, "commandKey"); this.state = requireText(state, "state"); this.reason = requireText(reason, "reason"); this.createdAt = Objects.requireNonNull(createdAt, "createdAt"); this.resolvedBy = optional(resolvedBy); this.resolvedAt = resolvedAt; } public String getCaseId() { return caseId; } public String getDeviceId() { return deviceId; } public String getCommandKey() { return commandKey; } public String getState() { return state; } public String getReason() { return reason; } public Instant getCreatedAt() { return createdAt; } public String getResolvedBy() { return resolvedBy; } public Instant getResolvedAt() { return resolvedAt; } private static String optional(String value) { return value == null || value.trim().isEmpty() ? null : value.trim(); } private static String requireText(String value, String field) { String text = optional(value); if (text == null) { throw new IllegalArgumentException(field + " must not be blank"); } return text; } }