package com.sptg.estate.api.feigns;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.dto.BillsDto;
import com.sptg.estate.api.dto.CarDto;
import com.sptg.estate.api.entity.Bills;
import com.sptg.estate.api.entity.Car;
import com.sptg.estate.api.feigns.fallback.BillsFeignFallbackFactory;
import com.sptg.estate.api.vo.BillsVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.plugins.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RequestMapping("/bills")
@FeignClient(value = "smart-house-estate",fallbackFactory = BillsFeignFallbackFactory.class)
public interface BillsFeign {

    /**
     *  获取账单列表
     * */
    @PostMapping("/list")
    Page<Bills> list(
            @RequestParam(value = "current",required = false) Integer current,
            @RequestParam(value = "size",required = false) Integer size,
            Bills bills
    );

    /**
     * 分页
     * @param dto
     * @return
     */
    @PostMapping(value = "/page")
    ResultBean<Page<Bills>> page(@RequestBody BillsDto dto);

    /**
     *  获取账单详情
     * */
    @GetMapping("/detail")
    BillsVO detail(@RequestParam(value = "id",required = true) Long id);

    /**
     *  根据id删除账单
     * */
    @PostMapping("/delete")
    ResultBean<Boolean> delete(@RequestBody BillsDto billsDto);

    /**
     *  更新账单
     *
     * @return*/
    @PostMapping("/edit")
    ResultBean<Boolean> edit(@RequestBody BillsDto billsDto);

    /**
     *  新增
     *
     * @return*/
    @PostMapping("/add")
    ResultBean<Boolean> add(@RequestBody BillsDto billsDto);
}
