package cn.iocoder.yudao.module.system.controller.app.languagetype;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.controller.admin.languagetype.vo.LanguageTypeRespVO;
import cn.iocoder.yudao.module.system.convert.languagetype.LanguageTypeConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.languagetype.LanguageTypeDO;
import cn.iocoder.yudao.module.system.service.languagetype.LanguageTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import java.util.List;

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

@Api(tags = "管理后台 - 语言类型")
@RestController
@RequestMapping("/system/language-type")
@Validated
public class AppLanguageTypeController {

    @Resource
    private LanguageTypeService languageTypeService;

    @GetMapping("/all")
    @PermitAll
    @ApiOperation("获得所有的语言类型")
    public CommonResult<List<LanguageTypeRespVO>> getAllLanguageTypeList() {
        List<LanguageTypeDO> list = languageTypeService.getAllLanguageTypeList();
        return success(LanguageTypeConvert.INSTANCE.convertList(list));
    }

}
