import { Injectable } from '@angular/core';
import { GenericService } from '@iqser/common-ui';
import { IAudit, IAuditResponse, IAuditSearchRequest, ICategory } from '@red/domain';
import { Observable } from 'rxjs';

@Injectable()
export class AuditService extends GenericService<IAudit> {
    protected readonly _defaultModelPath = 'audit';

    getCategories(): Observable<ICategory[]> {
        return super.getAll<ICategory[]>(`${this._defaultModelPath}/categories`);
    }

    searchAuditLog(body: IAuditSearchRequest): Observable<IAuditResponse> {
        return this._post(body, `${this._defaultModelPath}/search`);
    }
}
