package com.kingdee.eas.custom.integration.feishu;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.framework.ejb.EJBRemoteException;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.integration.feishu.app.FeishuConfigController;
import com.kingdee.shr.base.syssetting.SHRBaseItem;

import java.rmi.RemoteException;

/**
 * @Description TODO
 * @Date 2026/3/12 10:30
 * @Created by HeYuan
 */
public class FeishuConfig extends SHRBaseItem implements IFeishuConfig {
    public FeishuConfig() {
        super();
        registerInterface(IFeishuConfig.class, this);
    }

    public FeishuConfig(Context ctx) {
        super(ctx);
        registerInterface(IFeishuConfig.class, this);
    }

    public BOSObjectType getType() {
        return new BOSObjectType("AABD6B8B");
    }

    private FeishuConfigController getController() throws BOSException {
        return (FeishuConfigController) getBizController();
    }

    /**
     * 取值-System defined method
     *
     * @param pk 取值
     * @return
     */
    public FeishuConfigInfo getFeishuConfigInfo(IObjectPK pk) throws BOSException, EASBizException {
        try {
            return getController().getFeishuConfigInfo(getContext(), pk);
        } catch (RemoteException err) {
            throw new EJBRemoteException(err);
        }
    }

    /**
     * 取值-System defined method
     *
     * @param pk       取值
     * @param selector 取值
     * @return
     */
    public FeishuConfigInfo getFeishuConfigInfo(IObjectPK pk, SelectorItemCollection selector) throws BOSException, EASBizException {
        try {
            return getController().getFeishuConfigInfo(getContext(), pk, selector);
        } catch (RemoteException err) {
            throw new EJBRemoteException(err);
        }
    }

    /**
     * 取值-System defined method
     *
     * @param oql 取值
     * @return
     */
    public FeishuConfigInfo getFeishuConfigInfo(String oql) throws BOSException, EASBizException {
        try {
            return getController().getFeishuConfigInfo(getContext(), oql);
        } catch (RemoteException err) {
            throw new EJBRemoteException(err);
        }
    }

    /**
     * 取集合-System defined method
     *
     * @return
     */
    public FeishuConfigCollection getFeishuConfigCollection() throws BOSException {
        try {
            return getController().getFeishuConfigCollection(getContext());
        } catch (RemoteException err) {
            throw new EJBRemoteException(err);
        }
    }

    /**
     * 取集合-System defined method
     *
     * @param view 取集合
     * @return
     */
    public FeishuConfigCollection getFeishuConfigCollection(EntityViewInfo view) throws BOSException {
        try {
            return getController().getFeishuConfigCollection(getContext(), view);
        } catch (RemoteException err) {
            throw new EJBRemoteException(err);
        }
    }

    /**
     * 取集合-System defined method
     *
     * @param oql 取集合
     * @return
     */
    public FeishuConfigCollection getFeishuConfigCollection(String oql) throws BOSException {
        try {
            return getController().getFeishuConfigCollection(getContext(), oql);
        } catch (RemoteException err) {
            throw new EJBRemoteException(err);
        }
    }

    @Override
    public void setDefaultConfig(String billId) throws BOSException, EASBizException {
        try {
            getController().setDefaultConfig(getContext(), billId);
        } catch (RemoteException err) {
            throw new EJBRemoteException(err);
        }
    }

    @Override
    public FeishuConfigCollection getDefaultConfigs() throws BOSException, EASBizException {
        try {
            return getController().getDefaultConfigs(getContext());
        } catch (RemoteException err) {
            throw new EJBRemoteException(err);
        }
    }
}