import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {SERVER_API_URL} from '../app.constants';
import {Observable} from 'rxjs/Rx';
import {CommonService} from '../shared/common/common.service';

@Injectable()
export class EarlyWarningService {

    constructor(private http: HttpClient, private commonSer: CommonService) {
    }

    /***预警规则***/
    //分页查询
    pageWarningRule(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/warningRule/page', data);
    }

    //删除
    deleteWarningRule(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/warningRule/delete', data);
    }

    //新增
    addWarningRule(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/warningRule/add', data);
    }

    //查询
    findWarningRule(params): Observable<any> {
        return this.http.get(SERVER_API_URL + '/warningRule/find/' + params);
    }

    /***end***/

    /***预警消息***/
    //分页查询
    pageWarningMsg(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/warningMsg/page', data);
    }

    //添加批注
    updateWarningMsg(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/warningMsg/update', data);
    }

    //根据id查询预警信息
    findWarningMsg(params): Observable<any> {
        return this.http.get(SERVER_API_URL + '/warningMsg/find/' + params);
    }

    //跟踪消息分页查询
    msgPageWarningMsg(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/warningMsg/msgPage', data);
    }

    /***end***/
}
