import { Injectable } from '@nestjs/common';
import {
  EventTopics,
  columnUniques,
  validateRelations,
} from 'src/core/strings/constants/interface.constants';
import { TaxEntity } from '../../entities/tax.entity';
import { TaxModel } from '../../../data/models/tax.model';
import { BaseCreateManager } from 'src/core/modules/domain/usecase/managers/base-create.manager';
import { TaxCreatedEvent } from '../../entities/event/tax-created.event';

@Injectable()
export class CreateTaxManager extends BaseCreateManager<TaxEntity> {
  async beforeProcess(): Promise<void> {
    return;
  }

  async afterProcess(): Promise<void> {
    return;
  }

  get validateRelations(): validateRelations[] {
    return [];
  }

  get uniqueColumns(): columnUniques[] {
    return [{ column: 'name' }];
  }

  get eventTopics(): EventTopics[] {
    return [
      {
        topic: TaxCreatedEvent,
        data: this.data,
      },
    ];
  }

  get entityTarget(): any {
    return TaxModel;
  }
}
