package org.jeecg.modules.api.employController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.apiBean.PageBean;
import org.jeecg.modules.apiService.NewsService;
import org.jeecg.modules.apiService.OrderService;
import org.jeecg.modules.employOrder.entity.EmployOrder;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags="订单-订单相关接口")
@RestController
@RequestMapping("/employ/order")
@Slf4j
public class OrderController {
    /******************************************************************************************************************/
    //订单信息
    @Resource
    private OrderService orderService;
    /******************************************************************************************************************/

    //订单信息-查看订单列表
    @ApiOperation(value="订单信息-查看订单列表", notes="role-0:求职方 1：招聘方")
    @RequestMapping(value = "/queryOrderList", method = {RequestMethod.POST})
    public Result<?> queryOrderList(@RequestHeader("X-Access-Token")String token, String status, String role, PageBean pageBean){
        return orderService.queryOrderList(token, status, role, pageBean);
    }

    //订单信息-查看订单详情
    @ApiOperation(value="订单信息-根据订单id查看订单详情", notes="订单信息-根据订单id查看订单详情")
    @RequestMapping(value = "/queryOrderById", method = {RequestMethod.POST})
    public Result<?> queryOrderById(@RequestHeader("X-Access-Token")String token, String orderId){
        return orderService.queryOrderById(token, orderId);
    }

    //订单信息-添加订单
    @ApiOperation(value="订单信息-添加订单", notes="订单信息-添加订单")
    @RequestMapping(value = "/addOrder", method = {RequestMethod.POST})
    public Result<?> addOrder(@RequestHeader("X-Access-Token")String token, EmployOrder employOrder){
        return orderService.addOrder(token, employOrder);
    }

    //订单信息-添加订单
    @ApiOperation(value="订单信息-取消订单", notes="订单信息-取消订单")
    @RequestMapping(value = "/deleteOrder", method = {RequestMethod.POST})
    public Result<?> deleteOrder(@RequestHeader("X-Access-Token")String token, String orderId){
        return orderService.deleteOrder(token, orderId);
    }

}
