package com.xxfc.platform.vehicle.feign;

import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.dto.*;
import com.xxfc.platform.vehicle.pojo.vo.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created by ace on 2017/9/15.
 */
@FeignClient(name = "vehicle", contextId = "vh")
public interface VehicleFeign {
    @GetMapping(value = "/vehicleCategory/{id}")
    public ObjectRestResponse<VehicleCategory> getVehicleCategory(@PathVariable(value = "id") int id);

    @GetMapping(value = "/vehicleModel/{id}")
    public ObjectRestResponse<VehicleModel> get(@PathVariable(value = "id") int id);

    @GetMapping(value = "/vehicleInfo/{id}")
    public ObjectRestResponse<Vehicle> get(@PathVariable(value = "id") String id);

    @RequestMapping(value = "/vehicleInfo/findById", method = RequestMethod.GET)
    public RestResponse<Vehicle> findById(@RequestParam(value = "id") String id);

    @RequestMapping(value = "/vehicleInfo/getByIds", method = RequestMethod.GET)
    public RestResponse<List<Vehicle>> getByIds(@RequestParam(value = "ids") List<String> id);

    @GetMapping(value = "/vehicleInfo/app/unauth/getAllVehicleById")
    public ObjectRestResponse<List<Vehicle>> getAllVehicleById(@RequestParam(value = "vehicleFindAppDTO") String vehicleFindAppDTO);

    //提车
    @PostMapping("/backstage/vehicle/unauth/app/updVehicleFeign")
    public ObjectRestResponse updVehicleFeign(@RequestBody Vehicle vehicle);

    //提车
    @PostMapping("/active/small/departure")
    public RestResponse departureBySmall(@RequestBody VehicleDepartureVo departureVo);

    //还车
    @PostMapping("/active/small/arrival")
    public RestResponse arrivalBySmall(@RequestBody VehicleArrivalVo arrivalVo);

    @GetMapping(value = "/vehicleModel/app/unauth/findRandomVehicle")
    public ObjectRestResponse findRandomVehicle(@RequestParam(value = "number") Integer number);

    //修改评分
    @RequestMapping(value = "/vehicleModel/app/addScore", method = RequestMethod.GET)
    public RestResponse addScore(@RequestParam(value = "id") Integer id, @RequestParam(value = "score") Integer score);

    //租车预约（无需审核）
    @RequestMapping(value = "/vehicleInfo/rent/book/vehicle", method = RequestMethod.POST)
    public ObjectRestResponse<VehicleBookRecord> rentApplyVehicle(@RequestBody RentVehicleBookDTO rentVehicleBookDTO);

    //租车预约（需要审核）
    @RequestMapping(value = "/vehicleInfo/apply/book/vehicle", method = RequestMethod.POST)
    public ObjectRestResponse<VehicleBookRecord> applyBookVehicle(@RequestBody RentVehicleBookDTO rentVehicleBookDTO);

    //查询公司详情
    @RequestMapping(value = "/branchCompany/app/unauth/detail/{id}", method = RequestMethod.GET)
    public ObjectRestResponse<CompanyDetail> getCompanyDetail(@PathVariable(value = "id") Integer id);

    //查询车辆详情
    @RequestMapping(value = "/app/vehicle/app/unauth/detail/{id}", method = RequestMethod.GET)
    public ObjectRestResponse<VehicleVO> getVehicleDetail(@PathVariable("id") String id);

    //查询扩展信息
    @RequestMapping(value = "/app/vehicleEextension/app/unauth/tree", method = RequestMethod.GET)
    public ObjectRestResponse<List<VehicleExtensionVO>> vehicleEextensionTree(@RequestParam(value = "vehicleId")String vehicleId);

    //租车拒绝预约
    @RequestMapping(value = "/vehicleInfo/rent/book/reject/{bookRecordId}", method = RequestMethod.PUT)
    public RestResponse<Integer> rentRejectVehicleBooking(@PathVariable(value = "bookRecordId") Long bookRecordId);

    //取消预约
    @RequestMapping(value = "/vehicleInfo/rent/unbook/{bookRecordId}", method = RequestMethod.DELETE)
    public RestResponse<Integer> rentUnbookVehicle(@PathVariable(value = "bookRecordId") Long bookRecordId);

    //通过预约
    @RequestMapping(value = "/vehicleInfo/rent/book/prove/{bookRecordId}", method = RequestMethod.PUT)
    public RestResponse<Integer> rentProveVehicleBooking(@PathVariable(value = "bookRecordId") Long bookRecordId);

    //获取分公司列表
    @GetMapping("/branchCompany/all")
    public List<BranchCompany> companyAll(
            @RequestParam(value = "dataAll") Integer dataAll,
            @RequestParam(value = "dataCompany") String dataCompany,
            @RequestParam(value = "dataZone") String dataZone);

    //获取分公司列表
    @GetMapping("/company/base/app/unauth/companyId")
    public BranchCompany companyId(@RequestParam(value = "name") String name);

    @GetMapping("/branchCompany/entityList")
    public ObjectRestResponse<List<BranchCompany>> branchCompanyEntityList(@RequestParam("entity") Map<String, Object> entity);

    @RequestMapping(value = "/user/license/one", method = RequestMethod.GET)
    public RestResponse<VehicleUserLicense> one(@RequestParam(value = "id", defaultValue = "0") Integer id) throws Exception;

    @RequestMapping(value = "/user/license/company/getOne", method = RequestMethod.GET)
    public RestResponse<VehicleUserLicense> getOne(
            @RequestParam(value = "id", defaultValue = "0") Integer id) throws Exception;

    @RequestMapping(value = "/user/license/multi", method = RequestMethod.GET)
    public ObjectRestResponse<List<VehicleUserLicense>> multi(@RequestBody QueryMultiDTO dto) throws Exception;

    @GetMapping("/user/license/getVehicleLicenseList")
    public ObjectRestResponse<List<VehicleUserLicense>> getVehicleLicenseList(@RequestParam(value = "ids") String ids);

    /**
     * 获取优质车型接口
     *
     * @param page
     * @param limit
     * @return 返回
     */
    @GetMapping("/vehicleModel/goodList")
    ObjectRestResponse<List<GoodDataVO>> goodList(@RequestParam(value = "page") Integer page, @RequestParam("limit") Integer limit);

    /**
     * 根据一个id获取城市
     *
     * @param id
     * @return
     */
    @GetMapping("/sysRegion/getSysRegionById/{id}")
    RestResponse getSysRegionById(@PathVariable(value = "id") Integer id);

    /**
     * 多个城市code获取城市代码
     *
     * @param idSet
     * @return
     */
    @PostMapping("/sysRegion/getSysRegion")
    ObjectRestResponse<List<SysRegion>> getSysRegion(@RequestBody Set<Integer> idSet);

    /**
     * 获取公司所在的城市
     *
     * @param zoneList
     * @param companyList
     * @return
     */
    @GetMapping("/city/corporationCity")
    ObjectRestResponse<Set<Integer>> corporationCity(@RequestParam(value = "zoneList") String zoneList,
                                                     @RequestParam(value = "companyList") String companyList);


    @GetMapping("/accompanyingItem/app/unauth/items")
    public RestResponse<List<AccompanyingItemVo>> listAccompanyingItem();

    @GetMapping("/branchCompany/findByAreaId")
    List<Integer> findCompanyIdsByAreaId(@RequestParam(value = "areaId") Integer areaId);

    @GetMapping("/branchCompany/company")
    Map<Integer, BranComanyLeaderVo> findCompanyLeaderMapByIds(@RequestParam(value = "companyIds") List<Integer> companyIds);

    @GetMapping("/vehicleModel/app/unauth/detail-param")
    ObjectRestResponse<VModelDetailVO> detailByParam(@RequestParam("vehicleModel") Map<String, Object> vehicleModel);

    @PostMapping("/vehicleModel/app/unauth/findVehicleModelPage")
    public ObjectRestResponse<PageDataVO<VehicleModelVo>> findVehicleModelPageUnauthfind(@RequestBody VehicleModelQueryCondition vmqc);


    //cata

    /**
     * 查询当前车型拥有的标签
     *
     * @param ids
     * @return
     */
    @GetMapping("/cata/add/getCatasByIds/{ids}")
    public ObjectRestResponse<List<VehiclePlatCata>> getCatasByIds(@PathVariable("ids") String ids);

    @GetMapping("/vehicleInfo/findwith_plate_number")
    List<String> findbyPlateNumber(@RequestParam(value = "plateNumber") String plateNumber);

    /**
     * 根据位置查询
     *
     * @param branchCompanyFindDTO
     * @return
     */
    @PostMapping("/branchCompany/app/unauth/companys")
    PageDataVO<BranchCompanyListVO> findBranchCompanyWithPage(@RequestBody BranchCompanyFindDTO branchCompanyFindDTO);

    @GetMapping("/vehicleInfo/findVehicleIds")
    List<String> findbyPlateNumberAndVehicleCod(@RequestParam(value = "plateNumber") String plateNumber, @RequestParam(value = "vehicleCode") String vehicleCode);

    @RequestMapping(value = "/vehicleInfo/bookRecord/update", method = RequestMethod.POST)
    public ObjectRestResponse update(@RequestBody BookRecordUpdateLog bookRecordUpdateLog);

    @GetMapping(value ="/branchCompany/getCompanyIds")
    RestResponse<List<Integer>> getCompanyIds(@RequestParam(value = "dataZone")String dataZone ,@RequestParam(value = "dataCompany")String dataCompany);
    @GetMapping(value = "/bookRecord/get")
    public ObjectRestResponse<List<BookRecordUpdateLog>> get(@RequestParam(value = "bookRecordId")Long bookRecordId);


    /**
     * 车型日历价格
     *
     * @param startDate
     * @param endDate
     * @param vehicleModelId
     * @param userId
     * @return
     */
    @GetMapping(value = "/vehicle_model/calendar_price/app/unauth/price",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> findVehicleModelCalendarPriceByDate(@RequestParam(value = "startDate") Long startDate,
                                                                                               @RequestParam(value = "endDate") Long endDate,
                                                                                               @RequestParam(value = "vehicleModelId") Integer vehicleModelId,
                                                                                               @RequestParam(value = "userId") Integer userId);
    /**
     * 订单修改订单时间，同时需要修改预定记录
     *  * @param bookVehicleVo
     * @return
     */
    @RequestMapping(value = "/vehicleInfo/bookRecord/order-update", method = RequestMethod.POST)
    public RestResponse updateOrderBookRecord(@RequestBody BookVehicleVO bookVehicleVo);


    @GetMapping("/branchCompany/company_info")
    Map<Integer, String> findCompanyMap();

    @GetMapping("/area/areas")
    List<Area> findAllAreas();

    @GetMapping("/branchCompany/compnays_area")
    public List<BranchCompanyAreaDTO> findBranchCompnayAreaByIds(@RequestParam("companyIds") List<Integer> compnayIds);

    @ApiOperation("列表")
    @RequestMapping(value = "company/info/app/unauth/listByIds", method = RequestMethod.POST)
    ObjectRestResponse<List<CompanyInfo>> listByIds(@RequestBody CompanyInfoFindDTO companyInfoFindDTO);


    @PostMapping("branchCompany/app/unauth/listByIds")
    ObjectRestResponse<List<CompanySearchVO>> listByIds(@RequestBody CompanySearchDTO vo);

    @GetMapping(value = "/vehicleHolidayPriceInfo/getByVehicleIdFeign")
    public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> getPriceByVehicleIdFeign(
            @RequestParam("vehicleId") String vehicleId, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("userId") Integer userId, @RequestParam("companyId") Integer companyId);

    @GetMapping(value = "/vehicleInfo/v2/getPriceByVehicleFeign")
    public ObjectRestResponse<List<VehicleModelCalendarPriceDTO>> getPriceByVehicleIdFeignV2(
            @RequestParam("vehicleId") String vehicleId, @RequestParam("startDateTemp") Long startDateTemp, @RequestParam("endDateTemp") Long endDateTemp, @RequestParam("userId") Integer userId);

    @RequestMapping(value = "/vehicleInfo/selectByParam", method = RequestMethod.GET)
    public RestResponse<List<Vehicle>> vehicleSelectByParam(@RequestParam(value = "vehicle")Map<String, Object> vehicleMap);

    @RequestMapping(value = "/vehicleInfo/selectByCompanyIds", method = RequestMethod.GET)
    public ObjectRestResponse<List<Vehicle>> vehicleSelectByCompanyIds(@RequestParam("companyIds") String companyIds);

    @RequestMapping(value = "/vehicleInfo/rent/apply/usable-vehicle", method = RequestMethod.POST)
    public ObjectRestResponse<PageDataVO<UsableVeicleVO>> applyUsableVehicle(@RequestBody RentVehicleBookDTO rbd);

    @PostMapping("app/publishAeceive/app/unauth/updReceive")
    ObjectRestResponse updReceive(@RequestBody VehiclePublishReceiveDTO publishReceiveDTO);

}
