import { IProtocolRepository } from '../../domain/repositories/IProtocolRepository';
import { TelephoneProtocol, ProtocolCategory, AgeGroup } from '../../domain/entities/TelephoneProtocol';
import { telephoneProtocols } from '../../services/telephone-protocols';

export class StaticProtocolRepository implements IProtocolRepository {
  async findAll(): Promise<TelephoneProtocol[]> {
    return telephoneProtocols;
  }

  async findById(id: string): Promise<TelephoneProtocol | null> {
    const protocol = telephoneProtocols.find(p => p.id === id);
    return protocol || null;
  }

  async findByCategory(category: ProtocolCategory): Promise<TelephoneProtocol[]> {
    return telephoneProtocols.filter(p => p.category === category);
  }

  async findByAgeGroup(ageGroup: AgeGroup): Promise<TelephoneProtocol[]> {
    return telephoneProtocols.filter(p => p.ageGroup === ageGroup || p.ageGroup === 'todos');
  }
}
