package cn.qinys.platform.mobile.controller;

import cn.qinys.platform.base.response.Result;
import cn.qinys.platform.mobile.req.TreeCreateReq;
import cn.qinys.platform.mobile.req.TreeDetailReq;
import cn.qinys.platform.mobile.req.WishingTreeListReq;
import cn.qinys.platform.mobile.resp.TreeDetailResp;
import cn.qinys.platform.mobile.resp.TreeListResp;
import cn.qinys.platform.mobile.service.TreeService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lie tan
 * @description 许愿树移动端接口
 * @date 2026-05-17 22:25
 **/
@RestController
@RequestMapping("/dgapi/mobile/wishingtree")
public class TreeController {

    @Resource
    private TreeService treeService;

    /**
     * 查询附近许愿树列表
     */
    @PostMapping("/list")
    public Result<List<TreeListResp>> list(@RequestBody @Valid WishingTreeListReq req) {
        List<TreeListResp> list = treeService.listNearbyTrees(req);
        return new Result<>(list);
    }

    /**
     * 许愿树详情
     */
    @PostMapping("/detail")
    public Result<TreeDetailResp> detail(@RequestBody @Valid TreeDetailReq req) {
        TreeDetailResp resp = treeService.getTreeDetail(req);
        return new Result<>(resp);
    }
}
