"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.notificationsApiRecord = void 0;
const openApiSchemas_1 = require("../openApiSchemas");
const typebox_1 = require("@signalk/server-api/typebox");
const notificationsApiDoc = {
    openapi: '3.0.0',
    info: {
        version: '2.0.0',
        title: 'Signal K Notifications API',
        termsOfService: 'http://signalk.org/terms/',
        license: {
            name: 'Apache 2.0',
            url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
        }
    },
    externalDocs: {
        url: 'http://signalk.org/specification/',
        description: 'Signal K specification.'
    },
    servers: [{ url: '/signalk/v2/api/notifications' }],
    tags: [{ name: 'Alerts', description: 'Alerts & Alarms' }],
    components: {
        schemas: (0, openApiSchemas_1.typeboxToOpenApiSchemas)([
            typebox_1.NotificationIdParamSchema,
            typebox_1.AlarmStateSchema,
            typebox_1.AlarmMethodArraySchema,
            typebox_1.AlarmStatusSchema,
            typebox_1.AlarmSchema,
            typebox_1.NotificationResponseSchema
        ]),
        responses: {
            Notification: {
                description: 'OK',
                content: {
                    'application/json': {
                        schema: { $ref: '#/components/schemas/NotificationResponse' }
                    }
                }
            },
            '200Ok': {
                description: 'Successful operation',
                content: {
                    'application/json': {
                        schema: {
                            type: 'object',
                            description: '200 OK response',
                            properties: {
                                state: { type: 'string', enum: ['COMPLETE'] },
                                statusCode: { type: 'number', enum: [200] }
                            },
                            required: ['state', 'statusCode']
                        }
                    }
                }
            },
            ErrorResponse: {
                description: 'Failed operation',
                content: {
                    'application/json': {
                        schema: {
                            type: 'object',
                            description: 'Request error response',
                            properties: {
                                state: { type: 'string', enum: ['FAILED'] },
                                statusCode: { type: 'number', enum: [404] },
                                message: { type: 'string' }
                            },
                            required: ['state', 'statusCode', 'message']
                        }
                    }
                }
            }
        },
        parameters: {
            id: {
                name: 'id',
                in: 'path',
                description: 'Notification identifier',
                required: true,
                schema: { $ref: '#/components/schemas/NotificationIdParam' }
            }
        }
    },
    paths: {
        '/{id}/silence': {
            parameters: [{ $ref: '#/components/parameters/id' }],
            post: {
                tags: ['Alerts'],
                summary: 'Silence alert notification.',
                description: 'Removes `sound` from the ALARM METHOD of the notification and sets `status.silenced = true`.',
                responses: {
                    '200': { $ref: '#/components/responses/200Ok' },
                    default: { $ref: '#/components/responses/ErrorResponse' }
                }
            }
        },
        '/{id}/acknowledge': {
            parameters: [{ $ref: '#/components/parameters/id' }],
            post: {
                tags: ['Alerts'],
                summary: 'Acknowledge alert notification.',
                description: 'Removes both `visual` and `sound` from the ALARM METHOD of the notification and sets `status.acknowledged = true`.',
                responses: {
                    '200': { $ref: '#/components/responses/200Ok' },
                    default: { $ref: '#/components/responses/ErrorResponse' }
                }
            }
        }
    }
};
exports.notificationsApiRecord = {
    name: 'notifications',
    path: '/signalk/v1/api/vessels/self/notifications',
    apiDoc: notificationsApiDoc
};
//# sourceMappingURL=openApi.js.map