import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { LocalizationService } from '@shared/services/localization.service';

@Injectable({
    providedIn: 'root',
})
export class EndpointService {
    constructor(private localizationService: LocalizationService) {}

    public buildLocalizedURL(
        endpoint: string,
        version = 'v1.1',
        scope = 'flights',
    ) {
        const lang = this.localizationService.Language;

        return `${environment.apiRootUrl}/${scope}/${version}/${lang}/${endpoint}`;
    }

    public buildCommonURL(
        endpoint: string,
        version = 'v1.1',
        scope = 'flights',
    ) {
        return `${environment.apiRootUrl}/${scope}/${version}/${endpoint}`;
    }
}
