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

import type { I{{pascalCase entity}}Repository } from "../application/repositories/{{kebabCase entity}}.repository.interface";
import { Mock{{pascalCase entity}}Repository } from "../infrastructure/repositories/{{kebabCase entity}}.repository.mock";
import {
  get{{pascalCase entity}}UseCase,
  type IGet{{pascalCase entity}}UseCase,
} from "../application/use-cases/get-{{kebabCase entity}}.use-case";
import {
  get{{pascalCase entity}}Controller,
  type IGet{{pascalCase entity}}Controller,
} from "../interface-adapters/controllers/get-{{kebabCase entity}}.controller";
import { {{constantCase name}}_SYMBOLS } from "./symbols";

export const {{pascalCase name}}Module = new ContainerModule((bind: interfaces.Bind) => {
  bind<I{{pascalCase entity}}Repository>({{constantCase name}}_SYMBOLS.I{{pascalCase entity}}Repository).to(
    Mock{{pascalCase entity}}Repository,
  );

  bind<IGet{{pascalCase entity}}UseCase>(
    {{constantCase name}}_SYMBOLS.IGet{{pascalCase entity}}UseCase,
  ).toDynamicValue((ctx) =>
    get{{pascalCase entity}}UseCase(
      ctx.container.get<I{{pascalCase entity}}Repository>(
        {{constantCase name}}_SYMBOLS.I{{pascalCase entity}}Repository,
      ),
    ),
  );

  bind<IGet{{pascalCase entity}}Controller>(
    {{constantCase name}}_SYMBOLS.IGet{{pascalCase entity}}Controller,
  ).toDynamicValue((ctx) =>
    get{{pascalCase entity}}Controller(
      ctx.container.get<IGet{{pascalCase entity}}UseCase>(
        {{constantCase name}}_SYMBOLS.IGet{{pascalCase entity}}UseCase,
      ),
    ),
  );
});
