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

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

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

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

  get validateRelations(): validateRelations[] {
    return [{ relation: 'users' }];
  }

  get entityTarget(): any {
    return UserPrivilegeModel;
  }

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

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