package io.hmit.modules.appointment.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.DateUtils;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.AssertUtils;
import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.modules.appointment.dto.AppointmentTimeManageDTO;
import io.hmit.modules.appointment.dto.ReservationTimeDTO;
import io.hmit.modules.appointment.entity.AppointmentTimeManageEntity;
import io.hmit.modules.appointment.service.AppointmentTimeManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.List;
import java.util.Map;


/**
 * 预约时间管理
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-02-15
 */
@RestController
@RequestMapping("app/appointmenttimemanage")
@Api(tags="预约时间管理")
public class AppointmentTimeManageController {
    @Autowired
    private AppointmentTimeManageService appointmentTimeManageService;

    @GetMapping("getTime")
    @ApiOperation("获取当前正使用的时间段")
    public Result<AppointmentTimeManageDTO> getTime(){
        AppointmentTimeManageDTO data = appointmentTimeManageService.getByUseState();

        return new Result<AppointmentTimeManageDTO>().ok(data);
    }

    @GetMapping("getReservationTime")
    @ApiOperation("获取预约时间 今天往后7天的可预约时间")
    public Result<List<ReservationTimeDTO>> getReservationTime() throws ParseException {
        List<ReservationTimeDTO> data = appointmentTimeManageService.getReservationTimeList();

        return new Result<List<ReservationTimeDTO>>().ok(data);

    }


}
