import { BadRequestException, Injectable } from '@nestjs/common';
import { PaymentGatewayEnum } from '../interface/payment';
import { ZarinpalGateway } from './zarinpal.gateway';
import { IPaymentGateway } from '../interface/gateway';

@Injectable()
export class GatewayManager {
    constructor(
        private readonly zarinpal: ZarinpalGateway,
    ) { }

    get(gateway: PaymentGatewayEnum): IPaymentGateway {
        switch (gateway) {
            case PaymentGatewayEnum.ZarinPal:
                return this.zarinpal;
            default:
                throw new BadRequestException(`Unsupported gateway: ${gateway}`);
        }
    }
}
