export const shapeName = 'TSAiUsageItem';
/**
 * Schema for AI usage item tracking token consumption by service and model.
 * Matches the AiUsageItem type from @takeshape/util.
 */
export const schema = {
    title: shapeName,
    type: 'object',
    description: 'Token usage breakdown for a single service and model',
    properties: {
        service: {
            type: 'string',
            description: 'The AI service provider (e.g., "openai", "anthropic")'
        },
        model: {
            type: 'string',
            description: 'The model identifier (e.g., "gpt-4", "claude-3-opus")'
        },
        inputTokens: {
            type: 'number',
            description: 'Number of input/prompt tokens consumed'
        },
        outputTokens: {
            type: 'number',
            description: 'Number of output/completion tokens generated'
        },
        totalTokens: {
            type: 'number',
            description: 'Total tokens (input + output)'
        },
        inputTokenDetails: {
            type: 'object',
            description: 'Detailed breakdown of input token usage',
            properties: {
                noCacheTokens: {
                    type: 'number',
                    description: 'Tokens not using cache'
                },
                cacheReadTokens: {
                    type: 'number',
                    description: 'Tokens served from cache'
                },
                cacheWriteTokens: {
                    type: 'number',
                    description: 'Tokens written to cache'
                }
            }
        },
        outputTokenDetails: {
            type: 'object',
            description: 'Detailed breakdown of output token usage',
            properties: {
                textTokens: {
                    type: 'number',
                    description: 'Regular text output tokens'
                },
                reasoningTokens: {
                    type: 'number',
                    description: 'Extended thinking tokens'
                }
            }
        },
        guardrailUnits: {
            type: 'number',
            description: 'Number of guardrail units consumed'
        }
    },
    required: ['service', 'model'],
    additionalProperties: false
};
