import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Pagination } from '@xdf/commons';
import { DynaDataService } from '@xdf/gallery';
import { DataService } from '@xdf/gallery/lib/views/crud/services/data.service';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

@Injectable({
    providedIn: 'root'
})
export class MessageByIntentService extends DynaDataService {

    serviceURL = './dashboard/customer-interaction/message-by-intent';

    constructor(private httpClient: HttpClient) {
        super(httpClient);
    }

    getResultPagination(pagination: Pagination): Observable<Pagination> {
        return this.httpClient.post(this.serviceURL + '/page', pagination).pipe(map(data => this.getPage(data as Pagination)));
    }
}
