package com.sptg.estate.biz.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.dto.GuestRecordDto;
import com.sptg.estate.api.entity.GuestRecord;
import com.sptg.estate.api.feigns.GuestRecordFeign;
import com.sptg.estate.biz.service.GuestRecordServiceInterface;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

/**
 * title: GuestRecordController
 * package: com.sptg.estate.biz.controller
 * description: 访客登记信息记录 控制器
 *
 *
 *
 */
@RestController
public class GuestRecordController implements GuestRecordFeign {

    private final GuestRecordServiceInterface guestRecordInterface;

    @Autowired
    public GuestRecordController(GuestRecordServiceInterface guestRecordInterface) {
        this.guestRecordInterface = guestRecordInterface;
    }

    @Override
    @PostMapping(value = "/guestRecord/showGuestRecordList")
    public Page<GuestRecord> showGuestRecordList(@RequestBody GuestRecordDto guestRecordDto) {
        return this.guestRecordInterface.showGuestRecordList(guestRecordDto);
    }



    @Override
    @PostMapping(value = "/guestRecord/addGuestRecord")
    public ResultBean<GuestRecord> addGuestRecord(@RequestBody GuestRecord guestRecord) {
        return this.guestRecordInterface.addGuestRecord(guestRecord);
    }

    @Override
    @GetMapping(value = "/guestRecord/findGuestRecordById/{id}")
    public GuestRecord findGuestRecordById(@PathVariable(value = "id") Long id) {
        return this.guestRecordInterface.findGuestRecordById(id);
    }

    @Override
    @PostMapping(value = "/guestRecord/updateGuestRecord")
    public ResultBean<Boolean> updateGuestRecord(@RequestBody GuestRecordDto guestRecordDto) {
        return this.guestRecordInterface.updateGuestRecord(guestRecordDto);
    }

    @Override
    @PostMapping(value = "/guestRecord/deleteGuestRecord")
    public ResultBean<Boolean> deleteGuestRecord(@RequestBody GuestRecordDto guestRecordDto) {
        return this.guestRecordInterface.deleteGuestRecord(guestRecordDto);
    }

    @Override
    public ResultBean<Boolean> updateGuestRecordAuditStatus(GuestRecord guestRecord) {
        return null;
    }



    @Override
    @PostMapping(value = "/guestRecord/getListByUserId")
    public ResultBean<GuestRecord> getListByUserId(@RequestBody List<Long> userIds) {
        return this.guestRecordInterface.getListByUserId(userIds);
    }

    @Override
    @PostMapping(value = "/guestRecord/getByAuthId")
    public List<GuestRecord> findByCondition(@RequestBody GuestRecord guestRecord) {
        return this.guestRecordInterface.findByCondition(guestRecord);
    }


}
