package com.yupi.project.controller;

import com.yupi.project.common.BaseResponse;
import com.yupi.project.common.ResultUtils;
import com.yupi.project.model.entity.ParkingSpot;
import com.yupi.project.service.ParkingSpotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 车位接口 (用户端)
 */
@RestController
@RequestMapping("/parking-spot") // 修改这里：移除 /api 前缀
@Slf4j
@Api(tags = "车位接口 (用户端)")
public class ParkingSpotController {

    @Resource
    private ParkingSpotService parkingSpotService;

    @ApiOperation("获取可用且可指派的充电车位列表")
    @GetMapping("/list/available-assignable") // Specific path frontend is calling
    public BaseResponse<List<ParkingSpot>> listAvailableAndAssignableSpots() {
        List<ParkingSpot> spots = parkingSpotService.findAvailableAndAssignableSpots();
        return ResultUtils.success(spots);
    }

    // Można tu dodać inne publicznie dostępne endpointy dotyczące miejsc parkingowych, jeśli potrzebne
    // np. GET /parking-spot/{id} - publiczne dane o miejscu
} 