package com.jojubanking.boot.module.system.controller.app.carousel;

import com.jojubanking.boot.framework.common.pojo.CommonResult;
import com.jojubanking.boot.framework.common.pojo.PageResult;
import com.jojubanking.boot.module.system.controller.admin.carousel.vo.CarouselExportReqVO;
import com.jojubanking.boot.module.system.controller.admin.carousel.vo.CarouselRespVO;
import com.jojubanking.boot.module.system.controller.admin.hospital.vo.HospitalExportReqVO;
import com.jojubanking.boot.module.system.controller.admin.hospital.vo.HospitalRespVO;
import com.jojubanking.boot.module.system.controller.admin.information.vo.InformationExportReqVO;
import com.jojubanking.boot.module.system.controller.admin.information.vo.InformationRespVO;
import com.jojubanking.boot.module.system.controller.app.userinfo.vo.AppUserInfoPageReqVO;
import com.jojubanking.boot.module.system.controller.app.userinfo.vo.AppUserInfoRespVO;
import com.jojubanking.boot.module.system.convert.carousel.CarouselConvert;
import com.jojubanking.boot.module.system.convert.hospital.HospitalConvert;
import com.jojubanking.boot.module.system.convert.information.InformationConvert;
import com.jojubanking.boot.module.system.convert.userinfo.UserInfoConvert;
import com.jojubanking.boot.module.system.dal.dataobject.carousel.CarouselDO;
import com.jojubanking.boot.module.system.dal.dataobject.hospital.HospitalDO;
import com.jojubanking.boot.module.system.dal.dataobject.information.InformationDO;
import com.jojubanking.boot.module.system.dal.dataobject.userinfo.UserInfoDO;
import com.jojubanking.boot.module.system.service.carousel.CarouselService;
import com.jojubanking.boot.module.system.service.hospital.HospitalService;
import com.jojubanking.boot.module.system.service.information.InformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;

import static com.jojubanking.boot.framework.common.pojo.CommonResult.success;

/**
 * @ClassName: AppCarouselController
 * @Description:
 * @Author T.W
 * @Date 2023/3/20
 * @Version 1.0
 */
@Api(tags = "用户 APP - 用户信息")
@RestController
@RequestMapping("/member/carousel-info")
@Validated
public class AppCarouselController {
    @Resource
    private CarouselService carouselService;
    @Resource
    private InformationService informationService;
    @Resource
    private HospitalService hospitalService;

    @PostMapping("/page")
    @ApiOperation("获得轮播图分页")
    public CommonResult<List<CarouselRespVO>> getUserInfoList() {
        CarouselExportReqVO exportReqVO = new CarouselExportReqVO();
        exportReqVO.setType(1);
        List<CarouselDO> list = carouselService.getCarouselList(exportReqVO);
        return success(CarouselConvert.INSTANCE.convertList(list));
    }

    @PostMapping("/info")
    @ApiOperation("获得健康信息分页")
    public CommonResult<List<InformationRespVO>> getInformationInfoList() {
        InformationExportReqVO exportReqVO = new InformationExportReqVO();
        exportReqVO.setType(1);
        List<InformationDO> list = informationService.getInformationList(exportReqVO);
        return success(InformationConvert.INSTANCE.convertList(list));
    }

    @PostMapping("/hospital")
    @ApiOperation("获得医院信息分页")
    public CommonResult<HospitalRespVO> getHospitalInfoList() {
        HospitalExportReqVO exportReqVO = new HospitalExportReqVO();
        //exportReqVO.setType(1);
        List<HospitalDO> list = hospitalService.getHospitalList(exportReqVO);
        return success(HospitalConvert.INSTANCE.convert(list.get(0)));
    }

}
