import { Injectable } from '@nestjs/common';
import { BaseUpdateManager } from 'src/core/modules/domain/usecase/managers/base-update.manager';
import { PaymentMethodEntity } from '../../entities/payment-method.entity';
import { PaymentMethodModel } from '../../../data/models/payment-method.model';
import { PaymentMethodUpdatedEvent } from '../../entities/event/payment-method-updated.event';
import {
  EventTopics,
  columnUniques,
  validateRelations,
} from 'src/core/strings/constants/interface.constants';

@Injectable()
export class UpdatePaymentMethodManager extends BaseUpdateManager<PaymentMethodEntity> {
  async validateProcess(): Promise<void> {
    return;
  }

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

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

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

  get uniqueColumns(): columnUniques[] {
    // return [{ column: 'account_number' }, { column: 'account_name' }];
    return [
      {
        column: 'account_number',
        query: { account_name: this.data.account_name, type: this.data.type },
      },
    ];
  }

  get entityTarget(): any {
    return PaymentMethodModel;
  }

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