package com.seer.teach.mall.order.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.mall.response.AddressResp;
import com.seer.teach.mall.service.IAddressService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Captain
 * @since 2025-06-10
 */
@RestController
@RequestMapping("/mall/user/address")
@Tag(name = "管理端 - 收货地址管理")
@Validated
@RequiredArgsConstructor
@SaCheckLogin(type = StpUtil.TYPE)
public class AdminAddressController {

    private final IAddressService addressService;

    @GetMapping("/{id}")
    @SaCheckPermission("admin:address:get")
    @LogPrint
    @Operation(summary = "根据Id查询地址信息")
    public ResultBean<AddressResp> getAddressById(@PathVariable Integer id){
        return ResultBean.success(addressService.getAddressById(id));
    }
}
