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

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

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

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

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

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

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