package cn.sikey.mcdisk.service;

import cn.sikey.mcdisk.controller.app.familycloud.vo.InviteFamilyMemberRespVO;
import cn.sikey.mcdisk.convert.OauthConvert;
import cn.sikey.mcdisk.dal.dataobject.InviteFamilyMemberDO;
import cn.sikey.mcdisk.dal.mysql.InviteFamilyMemberMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Author: nelson
 * @Date: 2025/6/5
 * @Description: 邀请用户加入家庭成员
 */
@Service
@Slf4j
public class InviteFamilyMemberServiceImpl extends AbstractMcdiskService implements InviteFamilyMemberService {

    @Resource
    private InviteFamilyMemberMapper inviteFamilyMemberMapper;

    /**
     * 查询app用户认证
     *
     * @param userId   用户id
     * @param deviceId 设备编码
     * @return
     */
    @Override
    public InviteFamilyMemberRespVO queryAppOauth(String userId, String deviceId) {
        InviteFamilyMemberDO queryAppOauth = inviteFamilyMemberMapper.queryAppOauth(userId, deviceId);
        return OauthConvert.INSTANCE.convertInviteFamilyMemberRespVO(queryAppOauth);
    }

    /**
     * 保存邀请用户加入家庭成员
     *
     * @param inviteFamilyMemberDO 邀请用户加入家庭成员
     * @return
     */
    @Override
    public void saveInviteFamilyMember(InviteFamilyMemberDO inviteFamilyMemberDO) {
        inviteFamilyMemberMapper.insert(inviteFamilyMemberDO);
    }
}
