import { BaseBatchDeleteManager } from 'src/core/modules/domain/usecase/managers/base-batch-delete.manager';
import { ItemCategoryEntity } from '../../entities/item-category.entity';
import {
  EventTopics,
  validateRelations,
} from 'src/core/strings/constants/interface.constants';
import { ItemCategoryModel } from '../../../data/models/item-category.model';
import { ItemCategoryDeletedEvent } from '../../entities/event/item-category-deleted.event';
import { BatchResult } from 'src/core/response/domain/ok-response.interface';
import { Injectable } from '@nestjs/common';

@Injectable()
export class BatchDeleteItemCategoryManager extends BaseBatchDeleteManager<ItemCategoryEntity> {
  async beforeProcess(): Promise<void> {
    return;
  }

  async validateData(data: ItemCategoryEntity): Promise<void> {
    return;
  }

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

  get validateRelations(): validateRelations[] {
    return [
      {
        relation: 'items',
        message:
          'Gagal! tidak dapat mengubah tipe item karena sudah berelasi dengan item',
      },
    ];
  }

  get entityTarget(): any {
    return ItemCategoryModel;
  }

  get eventTopics(): EventTopics[] {
    return [
      {
        topic: ItemCategoryDeletedEvent,
      },
    ];
  }

  getResult(): BatchResult {
    return this.result;
  }
}
