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.UserExtendServiceApi;
import com.seer.teach.user.api.dto.UserExtendDTO;
import com.seer.teach.user.convert.UserExtendConvert;
import com.seer.teach.user.entity.UserExtendEntity;
import com.seer.teach.user.service.IUserExtendService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

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

    private final IUserExtendService userExtendService;

    @Override
    public UserExtendDTO getUserExtendById(Integer userId) {
        UserExtendEntity userExtend = userExtendService.getByUserId(userId);
        AssertUtils.notNull(userExtend, ResultCodeEnum.USER_NOT_FOUND);
        return UserExtendConvert.INSTANCE.toUserExtendDTO(userExtend);
    }
}
