"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateTemplateContent = exports.deleteTemplateContent = exports.addTemplateContent = exports.fetchTemplateContents = exports.updatePageContent = exports.deletePageContent = exports.addPageContent = exports.fetchPageContents = exports.offlineFromStore = exports.commitToStore = exports.fetchFileDetail = exports.fetchParentFiles = exports.getProjectFiles = exports.deleteFile = exports.updateTemplate = exports.addTemplate = exports.updatePage = exports.addPage = exports.updateProject = exports.deleteProject = exports.addProject = exports.fetchProjects = void 0;
const api_agent_1 = __importDefault(require("@/utils/api-agent"));
const fetchProjects = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/project-searchs', params, (rs) => {
        resolve(rs);
    });
});
exports.fetchProjects = fetchProjects;
const addProject = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/projects', params, (rs) => {
        resolve(rs);
    });
});
exports.addProject = addProject;
const deleteProject = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/projects/status', params, (rs) => {
        resolve(rs);
    });
});
exports.deleteProject = deleteProject;
const updateProject = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/projects', params, (rs) => {
        resolve(rs);
    });
});
exports.updateProject = updateProject;
const addPage = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/pages', params, (rs) => {
        resolve(rs);
    });
});
exports.addPage = addPage;
const updatePage = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/pages', params, (rs) => {
        resolve(rs);
    });
});
exports.updatePage = updatePage;
const addTemplate = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/templates', params, (rs) => {
        resolve(rs);
    });
});
exports.addTemplate = addTemplate;
const updateTemplate = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/templates', params, (rs) => {
        resolve(rs);
    });
});
exports.updateTemplate = updateTemplate;
// file relation
const deleteFile = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/file/delete', params, (rs) => {
        resolve(rs);
    });
});
exports.deleteFile = deleteFile;
const getProjectFiles = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/projects/files', params, (rs) => {
        resolve(rs);
    });
});
exports.getProjectFiles = getProjectFiles;
const fetchParentFiles = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/files/parents', params, (rs) => {
        resolve(rs);
    });
});
exports.fetchParentFiles = fetchParentFiles;
const fetchFileDetail = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/files', params, (rs) => {
        resolve(rs);
    });
});
exports.fetchFileDetail = fetchFileDetail;
const commitToStore = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/stores/goods', params, (rs) => {
        resolve(rs);
    });
});
exports.commitToStore = commitToStore;
const offlineFromStore = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/stores/goods-offline', params, (rs) => {
        resolve(rs);
    });
});
exports.offlineFromStore = offlineFromStore;
// content relation
// page
const fetchPageContents = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/pages/content-searchs', params, (rs) => {
        resolve(rs);
    });
});
exports.fetchPageContents = fetchPageContents;
const addPageContent = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/pages/contents', params, (rs) => {
        resolve(rs);
    });
});
exports.addPageContent = addPageContent;
const deletePageContent = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/pages/content-status', params, (rs) => {
        resolve(rs);
    });
});
exports.deletePageContent = deletePageContent;
const updatePageContent = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/pages/contents', params, (rs) => {
        resolve(rs);
    });
});
exports.updatePageContent = updatePageContent;
// template
const fetchTemplateContents = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/templates/content-searchs', params, (rs) => {
        resolve(rs);
    });
});
exports.fetchTemplateContents = fetchTemplateContents;
const addTemplateContent = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/templates/contents', params, (rs) => {
        resolve(rs);
    });
});
exports.addTemplateContent = addTemplateContent;
const deleteTemplateContent = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/templates/content-status', params, (rs) => {
        resolve(rs);
    });
});
exports.deleteTemplateContent = deleteTemplateContent;
const updateTemplateContent = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/templates/contents', params, (rs) => {
        resolve(rs);
    });
});
exports.updateTemplateContent = updateTemplateContent;
