import { Injectable } from '@angular/core'; import { HttpRestService } from '@core/services/http-rest.service'; import { ClientIntAuthorities, ClientSettings, CurrencySetting, SelectedLangsFromApi } from '@core/typings/api/admin-client.typing'; import { ClientBrandingFromApi, ColorSchemePayload, SaveBrandingForApi, UpdateClientCurrencyPayload } from '@core/typings/branding.typing'; @Injectable({ providedIn: 'root' }) export class ClientSettingsResources { constructor ( private httpRestService: HttpRestService ) { } getClientSettings (): Promise { const endpoint = 'api/client/settings/'; return this.httpRestService.get(endpoint); } getSelectedLanguages (): Promise { const endpoint = 'api/client/languages'; return this.httpRestService.get(endpoint); } getSelectedCurrencies (): Promise { const endpoint = 'api/client/currencies'; return this.httpRestService.get(endpoint); } getRegistrationAuthoritiees (countryCode: string): Promise { const endpoint = `/api/lookup/GetRegistrationAuthorities?countryCode=${countryCode}`; return this.httpRestService.get(endpoint); } updateClientLanguages (cultures: string[]) { const endpoint = 'api/client/languages/update'; return this.httpRestService.post(endpoint, { cultures }); } updateClientCurrencies (payload: UpdateClientCurrencyPayload) { const endpoint = 'api/client/currencies/update'; return this.httpRestService.post(endpoint, payload); } getBranding (): Promise { const endpoint = 'api/client/branding'; return this.httpRestService.get(endpoint); } saveBranding (payload: SaveBrandingForApi) { return this.httpRestService.post('api/client/branding', payload); } saveColorScheme (colorSchemes: ColorSchemePayload) { const endpoint = 'api/client/ClientColorScheme'; return this.httpRestService.post(endpoint, colorSchemes); } getClientSettingsForApplicant (clientID: number): Promise { return this.httpRestService.get(`api/portal/programs/clientSettings/${clientID}`); } getAvailableApplicantCurrencies (programId: number): Promise { const endpoint = `api/portal/programs/clientCurrencies/${programId}`; return this.httpRestService.get(endpoint); } }