package cn.iocoder.yudao.module.tkdata.controller.admin.countryInfo;

import cn.iocoder.yudao.module.tkdata.controller.admin.countryInfo.vo.CountryInfoRespVO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.countryinfo.CountryInfoDO;
import cn.iocoder.yudao.module.tkdata.service.countryInfo.CountryInfoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.security.PermitAll;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 国家与地区信息统计")
@RestController
@RequestMapping("/server/country-info")
@Validated
public class CountryInfoController {

    @Resource
    private CountryInfoService countryInfoService;

    @GetMapping("/get")
    @Operation(summary = "获得国家与地区信息统计")
    @Parameter(name = "region", description = "地区名称", required = true, example = "波黑")
    @PermitAll
    public CommonResult<List<CountryInfoRespVO>> getCountryInfo(@RequestParam("region")  String region) {
        return success(countryInfoService.getCountryInfo(region));
    }

}