package com.xindazhou.business.api.service;

import com.xindazhou.framework.common.pojo.CommonResult;
import com.xindazhou.framework.common.pojo.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 服务评价 API 接口
 *
 * @author xindazhou
 */
@FeignClient(name = "xdz-platform", contextId = "evaluationApi")
public interface EvaluationApi {

    /**
     * 获得服务评价分页列表
     *
     * @param pageNo 页码
     * @param pageSize 每页条数
     * @param keyword 关键字
     * @param rating 评分
     * @param createTimeStart 评价时间开始
     * @param createTimeEnd 评价时间结束
     * @return 服务评价分页
     */
    @GetMapping("/service/evaluation/page")
    CommonResult<PageResult<Map<String, Object>>> getEvaluationPage(
            @RequestParam("pageNo") Integer pageNo,
            @RequestParam("pageSize") Integer pageSize,
            @RequestParam(value = "keyword", required = false) String keyword,
            @RequestParam(value = "rating", required = false) Integer rating,
            @RequestParam(value = "createTimeStart", required = false) String createTimeStart,
            @RequestParam(value = "createTimeEnd", required = false) String createTimeEnd
    );

    /**
     * 获得服务评价
     *
     * @param id 评价ID
     * @return 服务评价
     */
    @GetMapping("/service/evaluation/{id}")
    CommonResult<Map<String, Object>> getEvaluation(@PathVariable("id") Long id);

}

