import { FastifyReply, FastifyRequest } from 'fastify';
import { ConfigService } from '../../services/_ConfigService';

export class ConfigController {
    private configService: ConfigService;

    constructor(configService: ConfigService) {
        this.configService = configService;
    }

    async getConfig(req: FastifyRequest, reply: FastifyReply) {
        try {
            // TODO: remove userId and make a id/role checker for user + add tenant
            const config = await this.configService.getConfig();
            reply.send(config);
        } catch (error) {
            console.log(error);
            reply.code(500).send({ message: 'Internal Server Error' });
        }
    }
}
