import { Injectable, inject } from '@angular/core'; import { ApiClient } from '@shared/infrastructure/api-client'; import { Valid } from '@registratie/domain/change-request.machine'; /** * Infrastructure adapter for the telefoonwijziging POST (`/api/v1/change-requests`) — * the single place the network client lives for contact changes, so the command * and the UI never touch `ApiClient`. The BRP address is authoritative and not * submitted (WP-34); only the phone number is. Returns the server reference; the * server re-validates and is the authority. */ @Injectable({ providedIn: 'root' }) export class ChangeRequestAdapter { private client = inject(ApiClient); async changeRequest(data: Valid): Promise { const res = await this.client.changeRequests({ telefoon: data.telefoon }); return res.referentie ?? ''; } }