package com.yingpaipay.web.controller;

import com.yingpaipay.web.domain.bo.AppletUserUpdateAvatarBo;
import com.yingpaipay.web.domain.bo.AppletUserUpdatePasswordBo;
import com.yingpaipay.web.domain.vo.AppletUserBasicInfoVo;
import com.yingpaipay.web.domain.vo.AppletUserInfoVo;
import com.yingpaipay.web.service.IAppletUserService;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Huanyi
 * @CreateTime: 2025-12-04
 * @Description:
 * @Version: 1.0
 */

@RestController
@RequestMapping("/applet/user")
@RequiredArgsConstructor
public class AppletUserController extends BaseController {

    private final IAppletUserService userService;

    @GetMapping("/getInfo")
    public R<AppletUserInfoVo> getInfo() {
        return R.ok(userService.getInfo());
    }

    @GetMapping("/getBasicInfo")
    public R<AppletUserBasicInfoVo> getBasicInfo() {
        return R.ok(userService.getBasicInfo());
    }

    @PutMapping("/updatePassword")
    public R<Void> updatePassword(@RequestBody AppletUserUpdatePasswordBo bo) {
        return toAjax(userService.updatePassword(bo));
    }

    @PutMapping("/updateAvatar")
    public R<Void> updateAvatar(@RequestBody AppletUserUpdateAvatarBo bo) {
        return toAjax(userService.updateAvatar(bo));
    }

}
