package org.jeecg.api.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.api.bean.HousePageList;
import org.jeecg.api.service.ApiIndexService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.commonComment.entity.CommonComment;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags="评论管理")
@RestController
@RequestMapping("/comment")
@Slf4j
public class ApiCommonController {


    @Resource
    private ApiIndexService apiIndexService;

    //根据房子标识查询房子评论
    @GetMapping(value = "/getCommentPageList")
    @ApiOperation(value="根据房子标识查询房子评论", notes="根据房子标识查询房子评论")
    public Result<?> getCommentPageList(String houseId, HousePageList bean){
        return apiIndexService.getCommentPageList(houseId,bean);
    }


    //发表评论
    @PostMapping(value = "/saveComment")
    @ApiOperation(value="发表评论", notes="发表评论")
    public Result<?> saveComment(@RequestHeader("X-Access-Token") String token, CommonComment comment){
        return apiIndexService.saveComment(token,comment);
    }

    //删除评论
    @PostMapping(value = "/deleteComment")
    @ApiOperation(value="删除评论", notes="删除评论")
    public Result<?> deleteComment(@RequestHeader("X-Access-Token") String token,String commentId){
        return apiIndexService.deleteComment(token,commentId);
    }


    //房源搜索条件-价格
    @GetMapping(value = "/getHousePrice")
    @ApiOperation(value="房源搜索条件-价格", notes="房源搜索条件-价格")
    public Result<?> getHousePrice(){
        return apiIndexService.getHousePrice();
    }

    //房源搜索条件-区域
    @GetMapping(value = "/getHouseArea")
    @ApiOperation(value="房源搜索条件-区域", notes="房源搜索条件-区域")
    public Result<?> getHouseArea(){
        return apiIndexService.getHouseArea();
    }

    //房源搜索条件-类型
    @GetMapping(value = "/getHouseIconClass")
    @ApiOperation(value="房源搜索条件-类型", notes="房源搜索条件-类型")
    public Result<?> getHouseIconClass(){
        return apiIndexService.getHouseIconClass();
    }

    //房源搜索条件-年限
    @GetMapping(value = "/getHouseYear")
    @ApiOperation(value="房源搜索条件-年限", notes="房源搜索条件-年限")
    public Result<?> getHouseYear(){
        return apiIndexService.getHouseYear();
    }



    //经济人获取账号密码以及邀请码
    @GetMapping(value = "/getAccountCode")
    @ApiOperation(value="经济人获取账号密码以及邀请码", notes="经济人获取账号密码以及邀请码")
    public Result<?> getAccountCode(@RequestHeader("X-Access-Token") String token){
        return apiIndexService.getAccountCode(token);
    }
}
