import upperFirst from 'lodash/upperFirst.js';
import * as agentMessageInput from "./agent-message-input.js";
import * as agentMessageOutput from "./agent-message-output.js";
import * as agentMessagePayload from "./agent-message-payload.js";
import * as agentSessionPayload from "./agent-session-payload.js";
const { sessionId, projectId, schemaId, ...schemaProperties } = agentMessagePayload.schema.properties;
export const schema = {
    type: 'object',
    properties: {
        ...schemaProperties,
        session: {
            ...agentSessionPayload.schema
        },
        aborted: {
            type: 'boolean',
            description: 'Indicates if the deferred message was aborted'
        },
        duration: {
            type: 'number',
            description: 'Duration of the deferred message processing in milliseconds'
        },
        status: {
            enum: ['PENDING', 'RUNNING', 'DONE'],
            description: 'The processing status of the agent message'
        }
    },
    required: ['messageId', 'status'],
    additionalProperties: true
};
export const shapeSchema = {
    ...schema,
    properties: {
        ...agentMessagePayload.shapeSchema.properties,
        session: agentSessionPayload.shapeSchema,
        aborted: schema.properties.aborted,
        duration: schema.properties.duration,
        status: schema.properties.status,
        input: {},
        output: {}
    },
    additionalProperties: false
};
export function createUserShapeSchema(params) {
    return {
        ...shapeSchema,
        properties: {
            ...shapeSchema.properties,
            session: {
                '@ref': agentSessionPayload.shapeName
            },
            input: {
                '@ref': agentMessageInput.shapeName
            },
            output: params?.properties?.output ?? {
                '@ref': agentMessageOutput.shapeName
            }
        },
        additionalProperties: false
    };
}
export function createUserShapeName(agentName) {
    return `${upperFirst(agentName)}AgentMessage`;
}
