import { IamCreateBoundedContextsHandler } from '@app/iam/bounded-context';
import type { RepositoryOptions, SeederBoundedContext } from '@aurorajs.dev/core-back';
import type { IIamBoundedContextSeeder } from '@bridges/iam/bounded-context/ports';
import { Injectable } from '@nestjs/common';

@Injectable()
export class IamBoundedContextSeederAdapter implements IIamBoundedContextSeeder {
  constructor(private readonly handler: IamCreateBoundedContextsHandler) {}

  async seedAll(items: SeederBoundedContext[], options: RepositoryOptions): Promise<void> {
    await this.handler.main(items, {
      timezone: process.env.TZ,
      repositoryOptions: options,
    });
  }
}
