package com.propertyManagement.web.controller.business.api;

import com.propertyManagement.business.domain.bo.WxCarportBo;
import com.propertyManagement.business.domain.vo.WxCarportVo;
import com.propertyManagement.business.service.IWxCarportService;
import com.propertyManagement.business.support.util.AuthUtil;
import com.propertyManagement.common.core.controller.BaseController;
import com.propertyManagement.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 业主车位
 *
 * @author liushuai
 * @date 2025-05-26
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/carport")
public class ApiWxCarportController extends BaseController {

    private final IWxCarportService iWxCarportService;

    /**
     * 查询业主车位列表
     */
    @GetMapping("/listByType")
    public R<List<WxCarportVo>> list(@Validated @NotNull(message = "车位类型不能为空") Integer type) {
        WxCarportBo wxCarportBo = new WxCarportBo();
        wxCarportBo.setType(type);
        wxCarportBo.setProprietorId(AuthUtil.getWxUser().getProprietorId());
        return R.ok(iWxCarportService.queryList(wxCarportBo));
    }

}
