import * as service from '../service/dataassetmanager';
import * as metadataService from '../service/metadata';

import { call } from 'redux-saga/effects';

export function* importElement(payload) {
  return yield call(service.importElement, payload);
}
  
export function* getLogs(payload) {
  return yield call(service.getLogs, payload);
}

export function* listElements(payload) {
  console.log('params',payload)
  return yield call(service.listElements,payload);
}

export function* listElementsAndFillValue(payload) {
  return yield call(service.listElementsAndFillValue, payload)
}

export function* listSupportSourceModels() {
  return yield call(service.listSupportSourceModels)
}

export function* listUserElements() {
  return yield call(service.listUserElements);
}

export function* listCustomElements() {
  return yield call(service.listCustomElements);
}

export function* listFilterElementIds(payload) {
  return yield call(service.listFilterElementIds, payload);
}

export function* listFilterElements() {
  return yield call(service.listFilterElements);
}

export function* listFilterElementsGroupByType(payload) {
  return yield call(service.listFilterElementsGroupByType, payload);
}

export function* setupFilterElementIds(payload) {
  return yield call(service.setupFilterElementIds, payload);
}

export function* listFilterElementIdsConfig() {
  return yield call(service.listFilterElementIdsConfig);
}

export function* setupFilterElementIdsConfig(payload) {
  return yield call(service.setupFilterElementIdsConfig, payload);
}

export function* addOrUpdateDataAsset(payload) {
  return yield call(service.addOrUpdateDataAsset, payload);
}

export function* checkCodeIsExist(payload) {
  return yield call(service.checkCodeIsExist, payload);
}

export function* checkDataAssetEditable(payload) {
  return yield call(service.checkDataAssetEditable, payload);
}

export function* addDataAssetByDirIds(payload) {
  return yield call(service.addDataAssetByDirIds, payload);
}

export function* deleteDataAssets(payload) {
  return yield call(service.deleteDataAssets, payload);
}

export function* getDataAssetDetail(payload) {
  return yield call(service.getDataAssetDetail, payload);
}

export function* getDraftDataAssetDetail(payload) {
  return yield call(service.getDraftDataAssetDetail, payload)
}

export function* listDataAssetsByPage(payload) {
  return yield call(service.listDataAssetsByPage, payload);
}

export function* listDataAssetsByPersonalCustomType(payload) {
  return yield call(service.listDataAssetsByPersonalCustomType, payload);
}

export function* listRecycleBinDataAssetsByPage(payload) {
  return yield call(service.listRecycleBinDataAssetsByPage, payload);
}
export function* addOrUpdateDirectory(payload) {
  return yield call(service.addOrUpdateDirectory, payload);
}

export function* checkDirectoryDeleteAble(payload) {
  return yield call(service.checkDirectoryDeleteAble, payload)
}

export function* deleteDirectory(payload) {
  return yield call(service.deleteDirectory, payload);
}
export function* deletePersonalCustomDirectory(payload) {
  return yield call(service.deletePersonalCustomDirectory, payload);
}
export function* existDataAsset(payload) {
  return yield call(service.existDataAsset, payload);
}
export function* queryAllDirectoryAsTree(payload) {
  return yield call(service.queryAllDirectoryAsTree, payload);
}
export function* queryDirectoryTreeByMetadataId(payload) {
  return yield call(service.queryDirectoryTreeByMetadataId, payload);
}
export function* queryResourceDirectoryAsTree() {
  return yield call(service.queryResourceDirectoryAsTree);
} 
export function* queryAssetDirectoryAsTree() {
  return yield call(service.queryAssetDirectoryAsTree);
}
export function* listAllTopics(payload) {
  return yield call(service.listAllTopics, payload);
}

export function* directoryImport(payload) {
  return yield call(service.directoryImport, payload);
}

export function* previewTreeByCustomElements(payload) {
  return yield call(service.previewTreeByCustomElements, payload);
}

export function* previewTreeByCustomElementsAndResourceType(payload) {
  return yield call(service.previewTreeByCustomElementsAndResourceType, payload);
}

export function* saveTreeByCustomElements(payload) {
  return yield call(service.saveTreeByCustomElements, payload);
}

export function* saveTreeByCustomElementsAndResourceType(payload) {
  return yield call(service.saveTreeByCustomElementsAndResourceType, payload);
}

export function* assetImport(payload) {
  return yield call(service.assetImport, payload);
}

// draftImport
export function* draftImport(payload) {
  return yield call(service.draftImport, payload);
}

export function* getDirectoryById(payload) {
  return yield call(service.getDirectoryById, payload);
}

export function* getPersonalCustomDirectoryById(payload) {
  return yield call(service.getPersonalCustomDirectoryById, payload);
}

export function* upDownDirectory(payload) {
  return yield call(service.upDownDirectory, payload);
}

export function* upDownPersonalCustomDirectory(payload) {
  return yield call(service.upDownPersonalCustomDirectory, payload);
}

export function* listDirectoryByName(payload) {
  return yield call(service.listDirectoryByName, payload);
}

export function* getDirectoryChild(payload) {
  return yield call(service.getDirectoryChild, payload);
}

export function* getPersonalCustomDirecotryChild(payload) {
  return yield call(service.getPersonalCustomDirecotryChild, payload);
}

export function* loadDataAssets(payload) {
  return yield call(service.loadDataAssets, payload);
}

export function* unloadDataAssets(payload) {
  return yield call(service.unloadDataAssets, payload);
}

export function* unloadDataAssetsFromAllDirs(payload) {
  return yield call(service.unloadDataAssetsFromAllDirs, payload);
}

export function* getDataAssetLocation(payload) {
  return yield call(service.getDataAssetLocation, payload);
}

export function* createDataAssetByMetadataIds(payload) {
  return yield call(service.createDataAssetByMetadataIds, payload);
}

export function* importLogs(payload) {
  return yield call(service.importLogs, payload);
}

// importDraftLogs
export function* importDraftLogs(payload) {
  return yield call(service.importDraftLogs, payload);
}

export function* recoveryFromRecycleBin(payload) {
  return yield call(service.recoveryFromRecycleBin, payload);
}

export function* getMetadataModelTree() {
  return yield call(service.getMetadataModelTree);
}

export function* getAttributesByMetadataModel(payload) {
  return yield call(service.getAttributesByMetadataModel, payload);
}

export function* loadElementWithoutCustom() {
  return yield call(service.loadElementWithoutCustom);
}

export function* saveEleAndAttrRel(payload) {
  return yield call(service.saveEleAndAttrRel, payload);
}

export function* getRelAttrByModel(payload) {
  return yield call(service.getRelAttrByModel, payload);
}

export function* listSourceModels(payload) {
  return yield call(service.listSourceModels, payload);
}

export function* saveEleAndAttrRelWithSourceModel(payload) {
  return yield call(service.saveEleAndAttrRelWithSourceModel, payload);
}

export function* getRelAttrBySourceModel(payload) {
  return yield call(service.getRelAttrBySourceModel, payload);
}

export function* deleteRelAttrBySourceModel(payload) {
  return yield call(service.deleteRelAttrBySourceModel, payload);
}

export function* fillElementValueBeforeCreate(payload) {
  return yield call(service.fillElementValueBeforeCreate, payload);
}

export function* countResourceState(payload) {
  return yield call(service.countResourceState, payload);
}

export function* getAssetPaths(payload) {
  return yield call(service.getAssetPaths, payload);
}

export function* getResourceRelations(payload) {
  return yield call(service.getResourceRelations, payload);
}

export function* updateResourceState(payload) {
  return yield call(service.updateResourceState, payload);
}

export function* subs(payload) {
  return yield call(service.subs, payload);
}

export function* startFlow(payload) {
  return yield call(service.startFlow, payload);
}

export function* getSystems(payload) {
  return yield call(service.getSystems, payload);
}

export function* getMetadataAttributes(payload) {
  return yield call(metadataService.getAttributes, payload);
}

export function* exportMetadataAttributes(payload) {
  return yield call(metadataService.exportAttributes, payload);
}

export function* importMetadataAttributes(payload) {
  return yield call(metadataService.importAttributes, payload);
}

export function* getMetadataImportAssetLog(payload) {
  return yield call(metadataService.listImportAssetLog, payload);
}

export function* getMetadataImportAssetLogDetail(payload) {
  return yield call(metadataService.getImportAssetLogDetail, payload);
}

export function* getStandardTree(payload) {
  return yield call(service.getStandardTree, payload);
}

export function* getStandardList(payload) {
  return yield call(service.getStandardList, payload);
}

export function* standardBatchMetadata(payload) {
  return yield call(service.standardBatchMetadata, payload);
}

export function* getMetadataStandardList(payload) {
  return yield call(service.getMetadataStandardList, payload);
}

export function* deleteStandardBatchMetadata(payload) {
  return yield call(service.deleteStandardBatchMetadata, payload);
}

export function* exportIndicator(payload) {
  return yield call(service.exportIndicator, payload);
}

export function* importIndicator(payload) {
  return yield call(service.importIndicator, payload);
} 

export function* importIndicatorLog(payload) {
  return yield call(service.importIndicatorLog, payload);
} 

export function* getPermission(payload) {
  return yield call(service.getPermission, payload);
}

export function* getTemplates() {
  return yield call(service.getTemplates)
}

export function* getMetadataTemplates(payload) {
  return yield call(service.getMetadataTemplates, payload)
}

export function* saveAsDraft(payload) {
  return yield call(service.saveAsDraft, payload)
}

export function* createDraftDataAssetByMetadataIds(payload) {
  return yield call(service.createDraftDataAssetByMetadataIds, payload)
}

export function* listDraftDataAssetsByPage(payload) {
  return yield call(service.listDraftDataAssetsByPage, payload)
}

export function* checkIsNeedSaveAsDraft(payload) {
  return yield call(service.checkIsNeedSaveAsDraft, payload)
}
// checkIsNeedSaveAsDraftDataAsset
export function* checkIsNeedSaveAsDraftDataAsset(payload) {
  return yield call(service.checkIsNeedSaveAsDraftDataAsset, payload)
}

// saveAsDraftDataAsset
export function* saveAsDraftDataAsset(payload) {
  return yield call(service.saveAsDraftDataAsset, payload)
}

// updateDraftDataAsset
export function* updateDraftDataAsset(payload) {
  return yield call(service.updateDraftDataAsset, payload)
}
