package com.chushang.task.feign;

import com.chushang.common.core.constant.SecurityConstants;
import com.chushang.common.core.web.Result;
import com.chushang.task.constants.TaskConstants;
import com.chushang.task.entity.dto.CreateTaskDTO;
import com.chushang.task.entity.dto.UpdateTaskDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @auther: zhao
 * @date: 2024/6/11 10:04
 */
@FeignClient(contextId = "taskFeign",
        value = TaskConstants.TASK_SERVICE,
        path = TaskConstants.APPLICATION_CONTENT_PATH + "/remote"
)
public interface RemoteTaskService {

    /**
     * 创建 后台任务
     */
    @PostMapping("/create")
    Result<Long> createTask(@RequestBody CreateTaskDTO taskInfo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 修改后台任务
     */
    @PostMapping(value = "/{taskId}")
    Result<Boolean> updateTask(@PathVariable(value = "taskId") Long taskId,
                               @RequestBody UpdateTaskDTO taskDTO,
                               @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
