package com.hw.job.api;

import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.ServiceNameConstants;
import com.hw.common.core.domain.R;
import com.hw.job.api.domain.SysJob;
import com.hw.job.api.factory.RemoteJobFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * @ClassName : RemoteJobService
 * @Description : zhouhy
 * @Author :
 * @Date: 2024-02-18 11:05
 */
@FeignClient(contextId = "remoteJobService", value = ServiceNameConstants.JOB_SERVICE, fallbackFactory = RemoteJobFallbackFactory.class)
public interface RemoteJobService {
    @PostMapping("/jobinner")
    R<Integer> add(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, SysJob job);
    @PostMapping("/jobinner/jobByPlanRepairId")
    SysJob selectJobList(Long planRepairId);
    @PostMapping("/jobinner/remove/{jobIds}")
    R<?> remove(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, @PathVariable("jobIds") Long[] jobIds);

    /**
     * 通过用户名查询用户信息
     *
     * @param jobId job主键
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/jobinner/info/{jobId}")
    public SysJob getJobInfo(@PathVariable("jobId") Long jobId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/jobinner/update")
    R<?> update(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, SysJob job);
}
