<commit_before>import { Injectable } from '@angular/core';
import { ALuEstablishmentService } from './establishment-service.model';
import { ILuEstablishment } from '../establishment.model';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

@Injectable()
export class LuEstablishmentService extends ALuEstablishmentService<ILuEstablishment> {
	constructor(protected _http: HttpClient) { super(); }

	getAll(filters: string[] = []): Observable<ILuEstablishment[]> {
		const url = [`/organization/structure/api/establishments`, ...filters.join('&')].join('?');

		return this._http.get<{ items: ILuEstablishment[] }>(url).pipe(
			map(res => res.items),
		);
	}
	getPaged(page: number = 0, filters: string[] = []): Observable<ILuEstablishment[]> {
		const url = [`/organization/structure/api/establishments`, [`page=${page + 1}`, ...filters].join('&')].join('?');
		return this._http.get<{ items: ILuEstablishment[] }>(url).pipe(
			map(res => res.items),
		);
	}
	searchAll(clue: string = '', filters: string[] = []): Observable<ILuEstablishment[]> {
		if (!clue) { return this.getAll(filters); }
		const urlSafeClues = clue.split(' ').map(c => encodeURIComponent(c));
		const url = [`/organization/structure/api/establishments`, [`search=${urlSafeClues}`, ...filters].join('&')].join('?');
		return this._http.get<{ items: ILuEstablishment[] }>(url).pipe(
			map(res => res.items),
		);
	}
	searchPaged(clue: string = '', page: number = 0, filters: string[] = []): Observable<ILuEstablishment[]> {
		if (!clue) { return this.getPaged(page, filters); }
		const urlSafeClues = clue.split(' ').map(c => encodeURIComponent(c));
		const url = [`/organization/structure/api/establishments`, [`search=${urlSafeClues}`, `page=${page + 1}`, ...filters].join('&')].join('?');
		return this._http.get<{ items: ILuEstablishment[] }>(url).pipe(
			map(res => res.items),
		);
	}
}<commit_msg>ng - ets service is generic v4 service with specific api<commit_after>import { Injectable } from '@angular/core';
import { ILuEstablishment } from '../establishment.model';
import { HttpClient } from '@angular/common/http';
import { LuApiV4Service } from '@lucca-front/ng/api';

@Injectable()
export class LuEstablishmentService extends LuApiV4Service<ILuEstablishment> {
	protected _api = `/organization/structure/api/establishments`;
	constructor(protected _http: HttpClient) { super(_http); }
}
{'fraction_non_alphanumeric': 0.19135046919624643, 'fraction_numerical': 0.0028559771521827824, 'mean_word_length': 5.4526315789473685, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2895433', 'n_tokens_mistral': 834, 'n_tokens_neox': 795, 'n_words': 163}