/**
 * src/server/openapi-spec.ts — Static OpenAPI 3.1 JSON object for Planu HTTP API
 *
 * SPEC-610: Planu HTTP API — OpenAPI document for LLM function calling
 */
export const OPENAPI_SPEC = {
    openapi: '3.1.0',
    info: {
        title: 'Planu HTTP API',
        version: '1.0.0',
        description: 'Planu Spec Driven Development HTTP API — transport-agnostic access to Planu engine',
    },
    servers: [
        {
            url: 'http://localhost:3000',
            description: 'Local development server',
        },
    ],
    paths: {
        '/api/health': {
            get: {
                operationId: 'getHealth',
                summary: 'Health check',
                description: 'Returns server status and version information',
                responses: {
                    '200': {
                        description: 'Server is healthy',
                        content: {
                            'application/json': {
                                schema: {
                                    type: 'object',
                                    properties: {
                                        data: {
                                            type: 'object',
                                            properties: {
                                                status: { type: 'string', example: 'ok' },
                                                version: { type: 'string', example: '1.0.0' },
                                                uptime: { type: 'number', description: 'Process uptime in seconds' },
                                            },
                                            required: ['status', 'version', 'uptime'],
                                        },
                                        error: { type: 'null' },
                                    },
                                },
                            },
                        },
                    },
                },
            },
        },
        '/api/specs': {
            get: {
                operationId: 'listSpecs',
                summary: 'List specs',
                description: 'Returns all specs, optionally filtered by status',
                parameters: [
                    {
                        name: 'status',
                        in: 'query',
                        description: 'Filter by spec status. Valid values: draft, review, approved, implementing, done, discarded',
                        required: false,
                        schema: {
                            type: 'string',
                            enum: ['draft', 'review', 'approved', 'implementing', 'done', 'discarded'],
                        },
                    },
                ],
                responses: {
                    '200': {
                        description: 'List of specs',
                        content: {
                            'application/json': {
                                schema: {
                                    type: 'object',
                                    properties: {
                                        data: {
                                            type: 'array',
                                            items: { $ref: '#/components/schemas/Spec' },
                                        },
                                        error: { type: 'null' },
                                    },
                                },
                            },
                        },
                    },
                },
            },
            post: {
                operationId: 'createSpec',
                summary: 'Create a spec',
                description: 'Creates a new spec with the given title and description',
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                type: 'object',
                                properties: {
                                    title: { type: 'string', description: 'Spec title' },
                                    description: { type: 'string', description: 'Spec description / requirements' },
                                },
                                required: ['title', 'description'],
                            },
                        },
                    },
                },
                responses: {
                    '201': {
                        description: 'Spec created',
                        content: {
                            'application/json': {
                                schema: {
                                    type: 'object',
                                    properties: {
                                        data: { $ref: '#/components/schemas/Spec' },
                                        error: { type: 'null' },
                                    },
                                },
                            },
                        },
                    },
                    '400': { $ref: '#/components/responses/BadRequest' },
                },
            },
        },
        '/api/specs/{id}': {
            get: {
                operationId: 'getSpec',
                summary: 'Get spec details',
                description: 'Returns a single spec by ID',
                parameters: [
                    {
                        name: 'id',
                        in: 'path',
                        required: true,
                        schema: { type: 'string', example: 'SPEC-001' },
                    },
                ],
                responses: {
                    '200': {
                        description: 'Spec details',
                        content: {
                            'application/json': {
                                schema: {
                                    type: 'object',
                                    properties: {
                                        data: { $ref: '#/components/schemas/Spec' },
                                        error: { type: 'null' },
                                    },
                                },
                            },
                        },
                    },
                    '404': { $ref: '#/components/responses/NotFound' },
                },
            },
        },
        '/api/specs/{id}/status': {
            patch: {
                operationId: 'updateSpecStatus',
                summary: 'Update spec status',
                description: 'Transitions a spec to a new status',
                parameters: [
                    {
                        name: 'id',
                        in: 'path',
                        required: true,
                        schema: { type: 'string', example: 'SPEC-001' },
                    },
                ],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                type: 'object',
                                properties: {
                                    status: {
                                        type: 'string',
                                        enum: ['draft', 'review', 'approved', 'implementing', 'done', 'discarded'],
                                        description: 'New status. Valid values: draft, review, approved, implementing, done, discarded',
                                    },
                                },
                                required: ['status'],
                            },
                        },
                    },
                },
                responses: {
                    '200': {
                        description: 'Spec status updated',
                        content: {
                            'application/json': {
                                schema: {
                                    type: 'object',
                                    properties: {
                                        data: { $ref: '#/components/schemas/Spec' },
                                        error: { type: 'null' },
                                    },
                                },
                            },
                        },
                    },
                    '400': { $ref: '#/components/responses/BadRequest' },
                    '404': { $ref: '#/components/responses/NotFound' },
                },
            },
        },
        '/api/specs/{id}/validate': {
            post: {
                operationId: 'validateSpec',
                summary: 'Validate a spec',
                description: 'Runs readiness and quality checks on a spec',
                parameters: [
                    {
                        name: 'id',
                        in: 'path',
                        required: true,
                        schema: { type: 'string', example: 'SPEC-001' },
                    },
                ],
                responses: {
                    '200': {
                        description: 'Validation results',
                        content: {
                            'application/json': {
                                schema: {
                                    type: 'object',
                                    properties: {
                                        data: {
                                            type: 'object',
                                            properties: {
                                                specId: { type: 'string' },
                                                ready: { type: 'boolean' },
                                                score: { type: 'number' },
                                                issues: {
                                                    type: 'array',
                                                    items: { type: 'string' },
                                                },
                                            },
                                        },
                                        error: { type: 'null' },
                                    },
                                },
                            },
                        },
                    },
                    '404': { $ref: '#/components/responses/NotFound' },
                },
            },
        },
        '/api/openapi.json': {
            get: {
                operationId: 'getOpenApiSpec',
                summary: 'OpenAPI specification',
                description: 'Returns this OpenAPI document for LLM function calling',
                responses: {
                    '200': {
                        description: 'OpenAPI spec',
                        content: {
                            'application/json': {
                                schema: { type: 'object' },
                            },
                        },
                    },
                },
            },
        },
    },
    components: {
        schemas: {
            Spec: {
                type: 'object',
                properties: {
                    id: { type: 'string', example: 'SPEC-001' },
                    title: { type: 'string' },
                    status: {
                        type: 'string',
                        enum: ['draft', 'review', 'approved', 'implementing', 'done', 'discarded'],
                    },
                    type: { type: 'string' },
                    scope: { type: 'string' },
                    difficulty: { type: 'string' },
                    risk: { type: 'string' },
                    tags: { type: 'array', items: { type: 'string' } },
                    createdAt: { type: 'string', format: 'date-time' },
                    updatedAt: { type: 'string', format: 'date-time' },
                },
                required: ['id', 'title', 'status'],
            },
            ApiError: {
                type: 'object',
                properties: {
                    message: { type: 'string' },
                    code: { type: 'string' },
                },
                required: ['message', 'code'],
            },
        },
        responses: {
            BadRequest: {
                description: 'Bad request — validation error',
                content: {
                    'application/json': {
                        schema: {
                            type: 'object',
                            properties: {
                                data: { type: 'null' },
                                error: { $ref: '#/components/schemas/ApiError' },
                            },
                        },
                    },
                },
            },
            NotFound: {
                description: 'Resource not found',
                content: {
                    'application/json': {
                        schema: {
                            type: 'object',
                            properties: {
                                data: { type: 'null' },
                                error: { $ref: '#/components/schemas/ApiError' },
                            },
                        },
                    },
                },
            },
            InternalError: {
                description: 'Internal server error',
                content: {
                    'application/json': {
                        schema: {
                            type: 'object',
                            properties: {
                                data: { type: 'null' },
                                error: { $ref: '#/components/schemas/ApiError' },
                            },
                        },
                    },
                },
            },
        },
    },
};
//# sourceMappingURL=openapi-spec.js.map