import { BaseCustomManager } from 'src/core/modules/domain/usecase/managers/base-custom.manager';
import { Injectable } from '@nestjs/common';
import { VipCodeEntity } from '../../entities/vip-code.entity';
import { EventTopics } from 'src/core/strings/constants/interface.constants';
import {
  generateCodeDate,
  generateRandom,
} from './helpers/generate-random.helper';

@Injectable()
export class GenerateVipCodeManager extends BaseCustomManager<VipCodeEntity> {
  validateProcess(): Promise<void> {
    return;
  }

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

  process(): Promise<void> {
    const month_year = generateCodeDate();
    const char = generateRandom(1);
    const number = generateRandom(2, true);

    this.result = `${month_year}${char}${number}`;
    return;
  }

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

  get entityTarget(): any {
    return;
  }

  getResult() {
    return this.result;
  }

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