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.service.concierge.IKpiConciergeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * concierge controller query last 60 days data
 * @author zhonglei.xu
 */
@Tag(name = "kpi_concierge")
@RestController
@RequestMapping("/kpi/concierge")
public class ConciergeController {


    @Autowired
    private IKpiConciergeService conciergeService;
    /**
     * Yas_Island_Campaigns last 60 days
     * @return Yas_Island_Campaigns
     */
    @GetMapping("/{department}")
    @Operation(summary = "concierge")
    public R<KpiConcierge> getConcierge(@PathVariable("department") String department) {
        KpiConcierge result=conciergeService.getConcierge(department);
        if(ObjectUtils.isEmpty(result)){
            R.ok(null, KeyConstants.CONCIERGE);
        }
        return R.ok(result, KeyConstants.CONCIERGE);
    }

}
