package com.cameleer.server.core.agent;

import java.time.Instant;

/**
 * Immutable record representing a command to be pushed to an agent.
 *
 * @param id            unique command identifier (UUID)
 * @param type          command type
 * @param payload       raw JSON payload
 * @param targetInstanceId target agent instance identifier
 * @param createdAt     when the command was created
 * @param status        current delivery status
 */
public record AgentCommand(
        String id,
        CommandType type,
        String payload,
        String targetInstanceId,
        Instant createdAt,
        CommandStatus status
) {

    public AgentCommand withStatus(CommandStatus newStatus) {
        return new AgentCommand(id, type, payload, targetInstanceId, createdAt, newStatus);
    }
}
