package com.centreproject.web.controller.kpi;

import com.centreproject.common.constant.KeyConstants;
import com.centreproject.common.core.domain.R;
import com.centreproject.system.domain.kpi.guestExperience.KpiVisitorCountryBreakdown;
import com.centreproject.system.domain.kpi.park.ParkEvents;
import com.centreproject.system.domain.vo.KpiVisitorCountryBreakdownVo;
import com.centreproject.system.domain.vo.ParkTicketTypeVo;
import com.centreproject.system.domain.vo.RevenueTrackingVo;
import com.centreproject.system.service.guestExperience.IKpiVisitorCountryBreakdownService;
import com.centreproject.system.service.park.IParkEventsService;
import com.centreproject.system.service.park.IParkTicketTypeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lenovo
 */
@Tag(name = "park")
@RestController
@RequestMapping("/kpi/park")
public class ParkDailyController {
    @Resource
    private IKpiVisitorCountryBreakdownService kpiVisitorCountryBreakdownService;
    @Resource
    private IParkEventsService parkEventsService;
    @Resource
    private IParkTicketTypeService parkTicketTypeService;

    /**
     *  visitor_country   kpi
     */
    @GetMapping("/visitor_country/{parkCode}")
    @Operation(summary = "visitor_country")
    public R<KpiVisitorCountryBreakdownVo> getVisitorCountry(@PathVariable("parkCode") String parkCode) {
        KpiVisitorCountryBreakdownVo result=kpiVisitorCountryBreakdownService.getVisitorBreakdownByCountryOfResidenceByParkCode(parkCode);
        return R.ok(result, KeyConstants.VISITOR_BREAKDOWN_BY_COUNTRY_OF_RESIDENCE);
    }


    /**
     *  park events   kpi
     */
    @GetMapping("/park_events/{parkCode}")
    @Operation(summary = "park_events")
    public R<List<ParkEvents>> getParkEvents(@PathVariable("parkCode") String parkCode) {
        List<ParkEvents> result=parkEventsService.getParkEvents(parkCode);
        return R.ok(result, KeyConstants.PARK_EVENTS);
    }


    /**
     *  park ticket type   kpi
     */
    @GetMapping("/park_ticket_type/{parkCode}")
    @Operation(summary = "park_ticket_type")
    public R<ParkTicketTypeVo> getParkTicketType(@PathVariable("parkCode") String parkCode) {
        ParkTicketTypeVo result=parkTicketTypeService.getParkTicketType(parkCode);
        return R.ok(result, KeyConstants.PARK_TICKET_TYPE);
    }
}
