import { params } from 'kit_utils';

const API = {
    GET_CONFIG: "/CityInterface/rest/services.svc/GetConfig",
    GENERATE_TOKEN: "/cityinterface/rest/services.svc/generatetoken",
    GET_WEB_SITE_CONFIG: '/CityInterface/rest/services.svc/GetWebSiteConfig',
    GET_USER_INFO: '/CityInterface/rest/services.svc/getUserInfo',
    GET_OA : '/CityInterface/rest/services/OA.svc/getLoginInfo',
    GET_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SaveLoginInfo',
    GET_INFORMATION: '/CityInterface/rest/services/CountyProduct.svc/SCADAOper/GetInformationInfo'
}
export default (vm) => {
    vm.getConfig = (data = {client: params.getParams('client'), ts: Date.now() }) => vm.get(API.GET_CONFIG,data).then(res => Promise.resolve(res))
    
    vm.generateToken = (data={}) => vm.get(API.GENERATE_TOKEN, data).then(res => Promise.resolve(res))

    vm.getWebSiteConfig = (data={}) => vm.get(API.GET_WEB_SITE_CONFIG, data).then(res => Promise.resolve(res))

    vm.getUserInfo = (data={}) => vm.get(API.GET_USER_INFO, data).then(res => Promise.resolve(res))

    vm.getOA = (data = {}) => vm.get(API.GET_OA, data).then(res => Promise.resolve(res))

    vm.writeLogs = (data = {}, config = {}) => vm.post(API.GET_LOGS, data, config).then(res => Promise.resolve(res))

    vm.getInformationInfo = (data={}) => vm.get(API.GET_INFORMATION, data).then(res => Promise.resolve(res))
}