package com.bonus.system.api;

import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.system.api.domain.SysLogsVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import com.bonus.common.core.constant.SecurityConstants;
import com.bonus.common.core.constant.ServiceNameConstants;
import com.bonus.common.core.domain.R;
import com.bonus.system.api.domain.SysLogininfor;
import com.bonus.system.api.domain.SysOperLog;
import com.bonus.system.api.factory.RemoteLogFallbackFactory;

import java.util.Map;

/**
 * 日志服务
 * 
 * @author bonus
 */
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService
{
    /**
     * 保存系统日志
     *
     * @param sysOperLog 日志实体
     * @param source 请求来源
     * @throws Exception 异常
     * @return 结果
     */
//    @PostMapping("/operlog")
//    public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
//

    /**
     * 保存日志
     *
     * @param sysLogsVo 日志实体
     * @param source 请求来源
     * @throws Exception 异常
     * @return 结果
     */
    @PostMapping("/operlog/addLogs")
    public R<Boolean> addLogs(@RequestBody SysLogsVo sysLogsVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;

    /**
     * 获取菜单信息
     * @param sysLogsVo
     * @param source
     * @return
     * @throws Exception
     */
    @PostMapping("/operlog/getLogsModule")
    public Map<String,String> getLogsModule(@RequestBody SysLogsVo sysLogsVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
    /**
     * 保存登录日志
     *
     * @param sysLogininfor 访问实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/logininfor")
    public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
