package com.engine.salary.wrapper;

import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.setting.dto.PageListTemplateDTO;
import com.engine.salary.entity.setting.dto.PageListTemplateDetailDTO;
import com.engine.salary.entity.setting.param.*;
import com.engine.salary.entity.setting.po.PageListTemplatePO;
import com.engine.salary.service.SalaryCacheService;
import com.engine.salary.service.SettingService;
import com.engine.salary.service.impl.SalaryCacheServiceImpl;
import com.engine.salary.service.impl.SettingServiceImpl;
import com.engine.salary.util.page.PageInfo;
import weaver.hrm.User;

import java.util.List;


public class SalaryCommonWrapper extends Service {

    private SalaryCacheService getSalaryCacheService(User user) {
        return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
    }

    private SettingService getSettingService(User user) {
        return ServiceUtil.getService(SettingServiceImpl.class, user);
    }

    public Object getCacheInfo(String key) {
        return getSalaryCacheService(user).get(key);
    }

    public void removeCache(String key) {
        getSalaryCacheService(user).remove(key);
    }

    public void savePageListSetting(PageListSettingSaveParam param) {
        getSettingService(user).savePageListSetting(param);
    }

    public void resetPageListSetting(PageListSettingResetParam param) {
        getSettingService(user).resetPageListSetting(param);
    }


    public PageListTemplateDetailDTO getPageListSetting(PageListSettingQueryParam param) {
        return getSettingService(user).getDefaultPageListSetting(param);
    }


    public PageListTemplateDetailDTO getPageListTemplate(PageListTemplateQueryParam param) {
       return   getSettingService(user).getPageListTemplate(param);
    }

    public List<PageListTemplatePO> getPageListTemplates(PageListTemplateQueryParam param) {
        return getSettingService(user).getPageListTemplates(param);
    }

    public PageInfo<PageListTemplateDTO> getTemplates(PageListTemplateQueryParam param) {
        return getSettingService(user).getTemplates(param);
    }

    public PageListTemplatePO savePageListTemplate(PageListTemplateSaveParam param) {
        return getSettingService(user).savePageListTemplate(param);
    }

    public void deletePageListTemplate(PageListTemplateDeleteParam param) {
         getSettingService(user).deletePageListTemplate(param);
    }

    public void changePageListTemplate(PageListTemplateChangeParam param) {
        getSettingService(user).changePageListTemplate(param);
    }


}
