package com.qmth.boot.api.controller;

import com.qmth.boot.api.annotation.Aac;
import com.qmth.boot.api.constant.ApiConstant;
import com.qmth.boot.core.solar.config.SolarProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("${" + ApiConstant.CONFIG_PREFIX + ".uri-prefix:" + ApiConstant.DEFAULT_URI_PREFIX + "}"
        + ApiConstant.BOOT_URI_PREFIX)
@Aac(auth = false, strict = false)

public class BootController {

    private SolarProperties solarProperties;

    private Map<String, Object> appInfo;

    public BootController(SolarProperties solarProperties) {
        this.solarProperties = solarProperties;
        this.appInfo = new HashMap() {{
            put("app", solarProperties.getAppCode());
            put("module", solarProperties.getModuleCode());
            put("version", solarProperties.getAppVersion());
        }};
    }

    @RequestMapping("/app-info")
    public Object appInfo() {
        return appInfo;
    }

}
