package com.viettel.campaign.web.rest;

import com.viettel.campaign.service.TicketService;
import com.viettel.campaign.web.dto.ResultDTO;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/ipcc/ticket")
@CrossOrigin
public class TicketController {

    private static final Logger LOGGER = Logger.getLogger(TicketController.class);

    @Autowired
    TicketService ticketService;

    @GetMapping("/getHistory")
    @ResponseBody
    public ResponseEntity searchCampaignExecute(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort, @RequestParam("customerId") String customerId) {
        ResultDTO result = ticketService.getHistory(page, pageSize, sort, customerId);
        return new ResponseEntity<>(result, HttpStatus.OK);
    }
}
