package com.hotent.uc.manager;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hotent.base.manager.BaseManager;
import com.hotent.uc.model.Demension;
import com.hotent.uc.model.Host;
import com.hotent.uc.model.Item;
import com.hotent.uc.model.ItemValue;
import com.hotent.uc.util.Request;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;
public interface ZabbixApi {
    void init();
    void destroy();
    String apiVersion();
    JSONObject call(Request request, boolean auth);
    boolean login(String user, String password);
    List<Host> hostList();
    List<Host> hostListByIp(List<String> ips);
    List<Host> hostListByName(String name);
    List<Item> hostMonitorItems(String hoistId);
    ItemValue hostMonitorItemLastValue(String itemId, Integer history);

    /**
     * @description  告警记录获取
     * @author  yangzibin
     * @date    2024/9/4 16:35
     * @param	actionsId
     * @param	timeFrom
     * @return  com.alibaba.fastjson.JSONArray
     */
    JSONArray getAlarmDataObtaining(String hostid);


    /**
     * @description  告警记录获取
     * @author  yangzibin
     * @date    2024/9/4 16:35
     * @param	actionsId
     * @param	timeFrom
     * @return  com.alibaba.fastjson.JSONArray
     */
    JSONArray getProblemList(String hostid);

    /**
     * @description  动作获取记录获取
     * @author  yangzibin
     * @date    2024/9/4 16:35
     * @param	actionsId
     * @param	timeFrom
     * @return  com.alibaba.fastjson.JSONArray
     */
    JSONArray getActionList(Integer actionsId, String timeFrom);

    cn.hutool.json.JSONArray getEventAlarm(String timeFrom, String timeTill);
    boolean checkAuthExpired();
    List<ItemValue> getHostSpecItemsLastValueCollection(String hostId, Set<String> itemIds, String valueType);
    /**
     * @description  创建web监控器
     * @author  yangzibin
     * @date    2024/9/5 10:36
     * @param	name
     * @param	url
     * @param	statusCode
     * @return  java.lang.String
     */
    String createZabbixWeb(String webName,String hostName,String hostId,String hostIp,cn.hutool.json.JSONArray sub_qzsub_jkxz);
    /**
     * @description  创建触发器
     * @author  yangzibin
     * @date    2024/9/26 14:45
     * @param	name
     * @param	filter
     * //        0 - (默认) 未分类;
     * //        1 - 信息;
     * //        2 - 警告;
     * //        3 - 一般严重;
     * //        4 - 严重;
     * //        5 - 灾难.
     * @return  java.lang.String
     */
    String createZabbixTrigger(cn.hutool.json.JSONArray sub_qzsub_jkxz,String hostName,String hostId,String hostIp,String proortiy);


    /**
     * @description  告警记录获取
     * @author  yangzibin
     * @date    2024/9/4 16:35
     * @param	actionsId
     * @param	timeFrom
     * @return  com.alibaba.fastjson.JSONArray
     */
    JSONArray getTriggerList(String hostid);

    String createActionFun(List<String> triggerName,String actionName);

    String productZabbixAlertData();

}
