// angular
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

// libs
import { Observable } from 'rxjs';

// app
import { ApiRoutes } from '../api-routes';
import { AccountCategoryModel } from '../model/account.category.model';

@Injectable()
export class AccountCategoryService {

	constructor(
		private httpClient: HttpClient,
	) {
	}

	public getCategories(): Observable<AccountCategoryModel[]> {
		return this.httpClient
			.get<AccountCategoryModel[]>(ApiRoutes.SettingsAccountCategories);
	}

	public getCategory(id: string): Observable<AccountCategoryModel> {
		return this.httpClient
			.get<AccountCategoryModel>(ApiRoutes.SettingsAccountCategory.replace(':id', id));
	}
}
