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 adreswijziging POST (`/api/v1/change-requests`) — * the single place the network client lives for change requests, so the command * and the UI never touch `ApiClient`. 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({ straat: data.straat, postcode: data.postcode, woonplaats: data.woonplaats, }); return res.referentie ?? ''; } }