package cn.qinys.platform.mobile.controller;

import cn.qinys.platform.base.response.Result;
import cn.qinys.platform.mobile.req.TreeAddressReq;
import cn.qinys.platform.mobile.req.TreeCreateReq;
import cn.qinys.platform.mobile.resp.TreeAddressResp;
import cn.qinys.platform.mobile.service.TreeService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lie tan
 * @description
 * @date 2026-06-15 19:26
 **/

@RestController
@RequestMapping("/dgapi/mobile/admin")
public class AdminController {

    @Resource
    private TreeService treeService;

    /**
     * 创建许愿树（管理员功能）
     */
    @PostMapping("/create/tree")
    public Result<Boolean> create(@RequestBody @Valid TreeCreateReq req) {
        treeService.create(req);
        return new Result<>(true);
    }

    /**
     * 创建许愿树（管理员功能）
     */
    @PostMapping("/get/address")
    public Result<TreeAddressResp> getAddress(@RequestBody @Valid TreeAddressReq req) {
        TreeAddressResp address = treeService.getAddress(req);
        return new Result<>(address);
    }

}
