/*
 * Copyright (c) 2022.
 * Author Peter Placzek (tada5hi)
 * For the full copyright and license information,
 * view the LICENSE file that was distributed with this source code.
 */

import {Connection} from "typeorm";
import {ExpressAppInterface} from "../config/http/express/type";
import {HttpServerInterface} from "../config/http/server";
import {ServerInterface} from "../modules/socket";
import {Environment} from "../env";
import {Config} from "../config";
import {createAuthApp} from "./auth";
import {createChatApp} from "./chat";

export type AppContext = {
    env: Environment,
    config: Config,
    expressApp: ExpressAppInterface,
    httpServer: HttpServerInterface,
    socketServer: ServerInterface,
    connection: Connection,
    [key: string] : any
}

export async function createApp(ctx: AppContext) {
   await createAuthApp(ctx);
   await createChatApp(ctx);
}
