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.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 weaver.hrm.User;

import java.util.List;
import java.util.Map;


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 pageListSettingSaveParam) {
        getSettingService(user).savePageListSetting(pageListSettingSaveParam);
    }


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


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

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

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

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

}
