import { Injectable } from '@nestjs/common';
import { BaseDeleteManager } from 'src/core/modules/domain/usecase/managers/base-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';

@Injectable()
export class DeleteUserPrivilegeManager extends BaseDeleteManager<UserPrivilegeEntity> {
  getResult(): string {
    return `Success`;
  }

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

  async beforeProcess(): 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,
        data: this.data,
      },
    ];
  }
}
