"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const swagger_jsdoc_1 = __importDefault(require("swagger-jsdoc"));
const sample_model_1 = require("../models/sample/sample.model");
const roles_endpoint_model_1 = require("../models/roles-endpoint.model");
const endpoint_model_1 = require("../models/endpoint.model");
const list_model_1 = require("../models/list.model");
const social_network_whatsapp_model_1 = require("../models/social-network/social-network-whatsapp.model");
const social_network_instagram_model_1 = require("../models/social-network/social-network-instagram.model");
const social_network_sms_model_1 = require("../models/social-network/social-network-sms.model");
const social_network_email_model_1 = require("../models/social-network/social-network-email.model");
const social_network_provider_model_1 = require("../models/social-network/social-network-provider.model");
const social_network_connect_model_1 = require("../models/social-network/social-network-connect.model");
function setSchemas(method, prefix) {
    return {
        [prefix + "GetItemSchema"]: method[prefix + "GetItem"],
        [prefix + "GetItemsSchema"]: (0, list_model_1.ListSwagger)(prefix + "GetItemSchema"),
        [prefix + "CreateItemSchema"]: method[prefix + "CreateItem"],
        [prefix + "UpdateItemSchema"]: method[prefix + "UpdateItem"],
        [prefix + "DeleteItemSchema"]: method[prefix + "DeleteItem"],
    };
}
const URL_SERVER = process.env.URL_SWAGGER;
const schemas = {
    ...setSchemas(endpoint_model_1.EndpointsModelSwagger, "Endpoints"),
    ...setSchemas(roles_endpoint_model_1.RolesEndpointsModelSwagger, "RolesEndpoints"),
    ...setSchemas(social_network_provider_model_1.SocialNetworkProvidersModelSwagger, "SocialNetworkProviders"),
    ...setSchemas(social_network_connect_model_1.SocialNetworkConnectsModelSwagger, "SocialNetworkConnects"),
    ...setSchemas(social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger, "SocialNetworkInstagrams"),
    SocialNetworkInstagramsSendMessagesSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsSendMessageItem,
    SocialNetworkInstagramsSendPhotosSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsSendPhotosItem,
    SocialNetworkInstagramsSendVideosSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsSendVideosItem,
    SocialNetworkInstagramsSendAudiosSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsSendAudiosItem,
    SocialNetworkInstagramsSendStoriesSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsSendStoriesItem,
    SocialNetworkInstagramsPublishPhotosSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsPublishMultimediaItem,
    SocialNetworkInstagramsPublishVideosSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsPublishMultimediaItem,
    SocialNetworkInstagramsPublishAlbumsSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsPublishMultimediaItem,
    SocialNetworkInstagramsPublishStorySchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsPublishStoryItem,
    SocialNetworkInstagramsConnectSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsConnectItem,
    SocialNetworkInstagramsDisconnectSchema: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsDisconnectItem,
    SocialNetworkInstagramsResponse: social_network_instagram_model_1.SocialNetworkInstagramsModelSwagger.SocialNetworkInstagramsResponse,
    SamplesGetItemSchema: sample_model_1.SamplesModelSwagger.SamplesGetItem,
    SamplesGetItemsSchema: (0, list_model_1.ListSwagger)("SamplesGetItemSchema"),
    SamplesCreateItemSchema: sample_model_1.SamplesModelSwagger.SamplesCreateItem,
    SamplesUpdateItemSchema: sample_model_1.SamplesModelSwagger.SamplesUpdateItem,
    SamplesDeleteItemSchema: sample_model_1.SamplesModelSwagger.SamplesDeleteItem,
    ...setSchemas(social_network_whatsapp_model_1.SocialNetworkWhatsappsModelSwagger, "SocialNetworkWhatsapps"),
    SocialNetworkWhatsappsConnectSchema: social_network_whatsapp_model_1.SocialNetworkWhatsappsModelSwagger.SocialNetworkWhatsappsConnectItem,
    SocialNetworkWhatsappsSendMessageItem: social_network_whatsapp_model_1.SocialNetworkWhatsappsModelSwagger.SocialNetworkWhatsappsSendMessageItem,
    ...setSchemas(social_network_sms_model_1.SocialNetworkSmssModelSwagger, "SocialNetworkSmss"),
    SocialNetworkSmsSendVerificationItem: social_network_sms_model_1.SocialNetworkSmssModelSwagger.SocialNetworkSmsSendVerificationItem,
    SocialNetworkSmsVerifyItem: social_network_sms_model_1.SocialNetworkSmssModelSwagger.SocialNetworkSmsVerifyItem,
    SocialNetworkEmailsGetItem: social_network_email_model_1.SocialNetworkEmailsModelSwagger.SocialNetworkEmailsGetItem,
    SocialNetworkEmailsGetItems: (0, list_model_1.ListSwagger)("SocialNetworkEmailsGetItem"),
    SocialNetworkEmailsCreateItem: social_network_email_model_1.SocialNetworkEmailsModelSwagger.SocialNetworkEmailsCreateItem,
    SocialNetworkEmailsSendItem: social_network_email_model_1.SocialNetworkEmailsModelSwagger.SocialNetworkEmailSendItem,
    SocialNetworkEmailsResponseItem: social_network_email_model_1.SocialNetworkEmailsModelSwagger.SocialNetworkEmailResponseItem,
    SocialNetworkEmailsSendVerification: social_network_email_model_1.SocialNetworkEmailsModelSwagger.SocialNetworkEmailsSendVerification,
    SocialNetworkEmailsSendVerify: social_network_email_model_1.SocialNetworkEmailsModelSwagger.SocialNetworkEmailsVerify,
    ErrorSchema: {
        type: "object",
        required: ["error"],
        properties: {
            error: {
                type: "string",
                nullable: true,
            },
            errors: {
                type: "array",
                nullable: true,
                items: {
                    type: "object",
                    properties: {
                        message: { type: "string" },
                        param: { type: "string" },
                        location: { type: "string" },
                    },
                },
            },
        },
    },
};
const swaggerDefinition = {
    openapi: "3.0.0",
    info: {
        title: "Documentacion de mi API",
        version: "1.0.0",
    },
    servers: [
        {
            url: URL_SERVER + "/v1/api",
        },
    ],
    definitions: schemas,
    components: {
        parameters: {
            store: {
                in: "header",
                name: "store",
                required: true,
                schema: {
                    type: "string",
                    minimum: 1,
                    default: "000111222333444555666777",
                },
                description: "Current store",
            },
            pageParam: {
                in: "query",
                name: "page",
                required: false,
                schema: {
                    type: "integer",
                    minimum: 1,
                    default: 1,
                },
                description: "The current page to return",
            },
            limitParam: {
                in: "query",
                name: "limit",
                required: false,
                schema: {
                    type: "integer",
                    minimum: 1,
                    maximum: 50,
                    default: 10,
                },
                description: "The numbers of items to return.",
            },
        },
        securitySchemes: {
            bearerAuth: {
                type: "http",
                scheme: "bearer",
            },
        },
        schemas: schemas,
    },
    security: [
        {
            bearerAuth: [],
        },
    ],
};
const swaggerOptions = {
    swaggerDefinition,
    apis: ["./app/routes/**/*.ts"],
};
exports.default = (0, swagger_jsdoc_1.default)(swaggerOptions);
