/**
 * V3.1 Task Record Types
 *
 * TaskRecord = projection of agent behavior into a structured execution step.
 * Created automatically by the system, not by agents directly.
 *
 * Three-layer model:
 *   Request → TaskRecord → TaskEvent
 *
 * @module types/v3/task-record.types
 */
import { v4 as uuidv4 } from 'uuid';
// ---------------------------------------------------------------------------
// Factory
// ---------------------------------------------------------------------------
/**
 * Creates a new TaskRecord with generated ID and timestamps.
 *
 * @param input - Creation parameters
 * @returns A new TaskRecord in 'created' status
 */
export function createTaskRecord(input) {
    const now = new Date().toISOString();
    return {
        id: uuidv4(),
        title: input.title,
        type: input.type,
        ownerAgent: input.ownerAgent,
        status: 'created',
        requestId: input.requestId,
        workItemId: input.workItemId,
        parentTaskId: input.parentTaskId,
        assignedBy: input.assignedBy,
        triggerId: input.triggerId,
        createdAt: now,
        updatedAt: now,
    };
}
/**
 * Creates a new TaskEvent with generated ID and timestamp.
 *
 * @param input - Event parameters
 * @returns A new TaskEvent
 */
export function createTaskEvent(input) {
    return {
        id: uuidv4(),
        taskId: input.taskId,
        eventType: input.eventType,
        agentId: input.agentId,
        timestamp: new Date().toISOString(),
        payload: input.payload ?? {},
    };
}
//# sourceMappingURL=task-record.types.js.map