import { ContainerModule, type interfaces } from "inversify";

import type { IHeaderRepository } from "../application/repositories/header.repository.interface";
import { MockHeaderRepository } from "../infrastructure/repositories/header.repository.mock";
import {
  getHeaderUseCase,
  type IGetHeaderUseCase,
} from "../application/use-cases/get-header.use-case";
import {
  getHeaderController,
  type IGetHeaderController,
} from "../interface-adapters/controllers/get-header.controller";
import { NAVIGATION_SYMBOLS } from "./symbols";

export const NavigationModule = new ContainerModule((bind: interfaces.Bind) => {
  bind<IHeaderRepository>(NAVIGATION_SYMBOLS.IHeaderRepository).to(
    MockHeaderRepository,
  );

  bind<IGetHeaderUseCase>(NAVIGATION_SYMBOLS.IGetHeaderUseCase).toDynamicValue(
    (ctx) =>
      getHeaderUseCase(
        ctx.container.get<IHeaderRepository>(NAVIGATION_SYMBOLS.IHeaderRepository),
      ),
  );

  bind<IGetHeaderController>(NAVIGATION_SYMBOLS.IGetHeaderController).toDynamicValue(
    (ctx) =>
      getHeaderController(
        ctx.container.get<IGetHeaderUseCase>(NAVIGATION_SYMBOLS.IGetHeaderUseCase),
      ),
  );
});
