import { Injectable } from '@nestjs/common';
import { BaseUpdateManager } from 'src/core/modules/domain/usecase/managers/base-update.manager';
import { GateEntity } from '../../entities/gate.entity';
import { GateModel } from '../../../data/models/gate.model';
import { GateUpdatedEvent } from '../../entities/event/gate-updated.event';
import {
  EventTopics,
  columnUniques,
  validateRelations,
} from 'src/core/strings/constants/interface.constants';
import { validateItemGate } from './helpers/validate-item-gate.helper';

@Injectable()
export class UpdateGateManager extends BaseUpdateManager<GateEntity> {
  async validateProcess(): Promise<void> {
    await validateItemGate(this.dataService, this.data, this.dataId);
    return;
  }

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

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

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

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

  get entityTarget(): any {
    return GateModel;
  }

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