import { z } from "@hono/zod-openapi";

//#region src/validation/event-schemas.ts
/**
* Agent transfer event data
* Used when an agent transfers control to another agent
*/
const TransferDataSchema = z.object({
	fromSubAgent: z.string().describe("ID of the sub-agent transferring control"),
	targetSubAgent: z.string().describe("ID of the sub-agent receiving control"),
	reason: z.string().optional().describe("Reason for the transfer"),
	context: z.any().optional().describe("Additional context data")
});
/**
* Delegation sent event data
* Used when an agent delegates a task to another agent
*/
const DelegationSentDataSchema = z.object({
	delegationId: z.string().describe("Unique identifier for this delegation"),
	fromSubAgent: z.string().describe("ID of the delegating sub-agent"),
	targetSubAgent: z.string().describe("ID of the sub-agent receiving the delegation"),
	taskDescription: z.string().describe("Description of the delegated task"),
	context: z.any().optional().describe("Additional context data")
});
/**
* Delegation returned event data
* Used when a delegated task is completed and returned
*/
const DelegationReturnedDataSchema = z.object({
	delegationId: z.string().describe("Unique identifier matching the original delegation"),
	fromSubAgent: z.string().describe("ID of the sub-agent that completed the task"),
	targetSubAgent: z.string().describe("ID of the sub-agent receiving the result"),
	result: z.any().optional().describe("Result data from the delegated task")
});
/**
* Data operation event details
* Used for emit operations and agent data events
*/
const DataOperationDetailsSchema = z.object({
	timestamp: z.number().describe("Unix timestamp in milliseconds"),
	subAgentId: z.string().describe("ID of the sub-agent that generated this data"),
	data: z.any().describe("The actual data payload")
});
/**
* Complete data operation event
* Includes type and label for user-facing display
*/
const DataOperationEventSchema = z.object({
	type: z.string().describe("Event type identifier"),
	label: z.string().describe("Human-readable label for the event"),
	details: DataOperationDetailsSchema
});
/**
* Message metadata for A2A communication
* Used in message passing between agents
*/
const A2AMessageMetadataSchema = z.object({
	fromSubAgentId: z.string().optional().describe("ID of the sending sub-agent"),
	toSubAgentId: z.string().optional().describe("ID of the receiving sub-agent"),
	fromExternalAgentId: z.string().optional().describe("ID of the sending external agent"),
	toExternalAgentId: z.string().optional().describe("ID of the receiving external agent"),
	taskId: z.string().optional().describe("Associated task ID"),
	a2aTaskId: z.string().optional().describe("A2A-specific task ID")
});

//#endregion
export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema };