package com.seer.teach.user.admin.api;

import com.seer.teach.common.enums.ResultCodeEnum;
import com.seer.teach.common.utils.AssertUtils;
import com.seer.teach.user.api.LevelServiceApi;
import com.seer.teach.user.api.dto.LevelDTO;
import com.seer.teach.user.convert.LevelConvert;
import com.seer.teach.user.entity.LevelEntity;
import com.seer.teach.user.service.ILevelService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *
 * </p >
 *
 * @author Captain
 * @since 2025-08-05 20:50
 */
@RequiredArgsConstructor
@RestController
public class LevelServiceApiImpl implements LevelServiceApi {

    private final ILevelService levelService;

    @Override
    public LevelDTO getLevelById(Integer id) {
        LevelEntity level = levelService.getById(id);
        AssertUtils.notNull(level, ResultCodeEnum.LEVEL_NOT_FOUND);
        return LevelConvert.INSTANCE.toLevelDTO(level);
    }
}
