"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.adminCcisRoutes = adminCcisRoutes;
const controller_1 = require("./controller");
const schema_1 = require("./schema");
function adminCcisRoutes(fastify) {
    return __awaiter(this, void 0, void 0, function* () {
        //-------------------------------------------------------------------------------
        fastify.get("presentation/", {
            preHandler: (req, reply) => fastify.adminAuth(req, reply, "CCIS"),
        }, controller_1.getPresentation);
        fastify.put("presentation/", {
            preHandler: (req, reply) => fastify.adminAuth(req, reply, "CCIS"),
            schema: {
                body: schema_1.presenationSchema,
            },
        }, controller_1.editPresentation);
        //-------------------------------------------------------------------------------
        fastify.get("terms-of-service/", {
            preHandler: (req, reply) => fastify.adminAuth(req, reply, "CCIS"),
        }, controller_1.getTermsOfService);
        fastify.put("terms-of-service/", {
            preHandler: (req, reply) => fastify.adminAuth(req, reply, "CCIS"),
            schema: {
                body: schema_1.termsOfServiceSchema,
            },
        }, controller_1.editTermsOfService);
        //-------------------------------------------------------------------------------
        fastify.get("privacy-policy/", {
            preHandler: (req, reply) => fastify.adminAuth(req, reply, "CCIS"),
        }, controller_1.getPrivacyPolicy);
        fastify.put("privacy-policy/", {
            preHandler: (req, reply) => fastify.adminAuth(req, reply, "CCIS"),
            schema: {
                body: schema_1.privacyPolicySchema,
            },
        }, controller_1.editPrivacyPolicy);
        //-------------------------------------------------------------------------------
        fastify.log.info("ccis routes registered");
    });
}
