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

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

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

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

  get uniqueColumns(): columnUniques[] {
    return [
      {
        column: 'code',
      },
    ];
  }

  get eventTopics(): EventTopics[] {
    return [
      {
        topic: VipCodeCreatedEvent,
        relations: ['vip_category'],
      },
    ];
  }

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