package com.caliverse.admin.domain.api;

import com.caliverse.admin.domain.RabbitMq.RabbitMqService;
import com.caliverse.admin.global.common.constants.AdminConstants;
import com.caliverse.admin.logs.Indicatordomain.StartEndTime;
import com.caliverse.admin.logs.logservice.LogServiceHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

@Slf4j
@RestController
@RequestMapping("/dev-test")
public class TestDevController {

    @Autowired
    private RabbitMqService m_rabbitMq;

    // Send Test
    @PostMapping("/get-server-time")
    public ResponseEntity<StartEndTime> sendRabbitMq() throws IOException, TimeoutException {

        StartEndTime startEndTime = LogServiceHelper.getCurrentLogSearchEndTime(AdminConstants.STAT_DAY_NUM);

        return ResponseEntity.ok().body(startEndTime);

    }
}
