/**
 * Repository for VoiceConfig.
 * Uses standard TypeORM repository (no schema-per-tenant — uses tenantId column filter).
 */
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { VoiceConfig } from '../../domain/entities/voice-config.entity';

@Injectable()
export class VoiceConfigRepository {
  constructor(
    @InjectRepository(VoiceConfig)
    private readonly repo: Repository<VoiceConfig>,
  ) {}

  async findByTenantId(tenantId: string): Promise<VoiceConfig | null> {
    return this.repo.findOneBy({ tenantId });
  }

  async save(entity: VoiceConfig): Promise<VoiceConfig> {
    return this.repo.save(entity);
  }
}
