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

@Injectable()
export class ProjectService {

    headers;
    options;

    constructor(private http: HttpClient, private commonSer: CommonService,
                private localStorage: LocalStorageService, private sessionStorage: SessionStorageService) {
    }

    //修改运维公司
    updateMaintainCompany(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainCompany/updateMaintainCompany', data);
    }

    //删除运维公司
    deleteMaintainCompany(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainCompany/deleteMaintainCompany', data);
    }

    //增加运维公司
    addMaintainCompany(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainCompany/addMaintainCompany', data);
    }

    //查询运维公司
    selectMaintainCompany(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainCompany/selectMaintainCompany', data);
    }

    //查询运维公司
    selectMaintainCompanyCountsById(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainCompany/selectMaintainCompanyCountsById', data);
    }

    //修改运维团队
    updateMaintainTeam(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeam/updateMaintainTeam', data);
    }

    //创建运维团队
    addMaintainTeam(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeam/addMaintainTeam', data);
    }

    //删除运维团队
    deleteMaintainTeam(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeam/deleteMaintainTeam', data);
    }

    //查询运维团队数量
    selectTeamCountById(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeam/selectTeamCountById', data);
    }

    //查询运维团队
    selectMaintainTeam(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeam/selectMaintainTeam', data);
    }

    //修改运维团队成员
    updateMaintainTeamUser(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeamUser/updateMaintainTeamUser', data);
    }

    //创建运维成员
    addMaintainTeamUser(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeamUser/addMaintainTeamUser', data);
    }

    //删除运维团队成员
    deleteMaintainTeamUser(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeamUser/deleteMaintainTeamUser', data);
    }

    //查询运维团队成员数量
    selectTeamUserCount(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeamUser/selectTeamUserCount', data);
    }

    //查询运维成员
    selectMaintainTeamUser(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainTeamUser/selectMaintainTeamUser', data);
    }

    //修改运维项目
    updateMaintainProject(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/updateMaintainProject', data);
    }

    //创建运维项目
    addMaintainProject(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/addMaintainProject', data);
    }

    //删除运维项目
    deleteMaintainProject(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/deleteMaintainProject', data);
    }

    //查询运维项目
    selectMaintainProject(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/selectMaintainProject', data);
    }

    //查询运维项目数量
    selectProjectCount(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/selectProjectCount', data);
    }

    //跟踪记录查询
    selectProjectCount1(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/selectProjectCount', data);
    }

    //费用记录
    //修改费用记录
    updateCost(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/cost/updateCost', data);
    }

    //分页筛选费用记录
    findPageCost(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/cost/findPage', data);
    }

    //批量删除费用记录
    deleteCost(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/cost/deleteCost', data);
    }

    //新增费用记录
    addCost(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/cost/addCost', data);
    }

    //根据费用id查询
    findById(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/cost/findById', data);
    }

    //手动添加跟踪信息
    addMaintainProjectTrackMsg(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/addMaintainProjectTrackMsg', data);
    }

    //跟踪信息
    selectMaintainProjectTrackMsg(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/selectMaintainProjectTrackMsg', data);
    }

    //下载
    exportExcel(data): Observable<any> {
        return this.http.post(SERVER_API_URL + '/maintainProject/exportExcel', data, {responseType: 'blob'});
    }
}
