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.concierge.KpiConcierge;
import com.centreproject.system.domain.kpi.digitalGx.KpiDigitalGx;
import com.centreproject.system.service.guestExperience.IKpiDigitalGxService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Digital GX controller query last 60 days data
 * @author zhonglei.xu
 */
@Tag(name = "kpi_digitalGx")
@RestController
@RequestMapping("/kpi/digital")
public class DigitalGxController {


    @Resource
    private IKpiDigitalGxService kpiDigitalGxService;
    /**
     * Digital GX last 60 days
     * @return Digital GX
     */
    @GetMapping("/gx")
    @Operation(summary = "gx")
    public R<KpiDigitalGx> getGx() {
        KpiDigitalGx result=kpiDigitalGxService.getGx();
        if(ObjectUtils.isEmpty(result)){
            R.ok(null, KeyConstants.DIGITAL_GX);
        }
        return R.ok(result, KeyConstants.DIGITAL_GX);
    }
}
