package com.securitycontrol.system.api;


import com.securitycontrol.common.core.constant.SecurityConstants;
import com.securitycontrol.common.core.constant.ServiceNameConstants;
import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.system.api.domain.SysLog;
import com.securitycontrol.system.api.domain.SysLogininfor;
import com.securitycontrol.system.api.domain.SysOperLog;
import com.securitycontrol.system.api.factory.RemoteLogFallbackFactory;
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;

/**
 * 日志服务
 *
 * @author czc
 */

@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
public interface RemoteLogService {
    /**
     * 保存系统日志
     *
     * @param sysOperLog 日志实体
     * @param source     请求来源
     * @return 结果
     */
    @PostMapping("/sys/logs/saveLogs")
    public Result<Boolean> saveLogs(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 保存访问记录
     *
     * @param sysLogininfor 访问实体
     * @param source        请求来源
     * @return 结果
     */
    @PostMapping("/sys/logs/saveLogininfor")
    public Result<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 保存系统日志
     * @param sysLog
     * @param source
     * @return Result<Boolean>
     * @description
     * @author cwchen
     * @date 2024/2/28 17:38
     */
    @PostMapping("/sys/sysLog/saveLogs")
    public Result<Boolean> saveSysLog(@RequestBody SysLog sysLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
