package com.its.api.its.controller.parking;

import com.its.api.its.model.dto.parking.ParkingLotDto;
import com.its.api.its.service.parking.ParkingLotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@Api(tags = "19.주차장-1.주차장관리-0.정보관리")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/parking/manager/info")
public class ParkingLotController {

    private final ParkingLotService service;

    @ApiOperation(value = "주차장 전체조회(PARKINGLOT)", response = ParkingLotDto.class)
    @GetMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<ParkingLotDto> findAll() {
        return service.findAll();
    }

    @ApiOperation(value = "주차장 개별조회(PARKINGLOT)", response = ParkingLotDto.class)
    @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public ParkingLotDto findById(@PathVariable final String id) {
        return this.service.findById(id);
    }

    /*@ApiOperation(value = "주차장 정보변경(PARKINGLOT)", response = ParkingLotDto.class)
    @PutMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public ParkingLotDto updateById(@PathVariable final String id, @RequestBody @Valid final ParkingLotDto.ParkingLotUpdReq req) {
        return this.service.updateById(id, req);
    }*/

    /*@ApiOperation(value = "주차장 정보변경/생성-목록(PARKINGLOT)", response = ParkingLotDto.class)
    @PostMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<ParkingLotDto> mergeInfoList(@RequestBody @Valid final List<ParkingLotDto.ParkingLotUpdReq> listReq) {
        return this.service.mergeInfoList(listReq);
    }*/

    @ApiOperation(value = "주차장 정보변경/생성-개별(PARKINGLOT)", response = ParkingLotDto.class)
    @PostMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public ParkingLotDto mergeInfo(@PathVariable("id") String id, @RequestBody @Valid final ParkingLotDto.ParkingLotUpdReq req) {
        return this.service.mergeInfo(req);
    }

    @ApiOperation(value = "주차장 정보삭제-개별(PARKINGLOT)", response = ParkingLotDto.class)
    @DeleteMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
    public ParkingLotDto deleteDataById(@PathVariable("id") String id) {
        return this.service.deleteById(id);
    }

   /* @ApiOperation(value = "주차장 정보삭제-목록(PARKINGLOT)", response = ParkingLotDto.class)
    @DeleteMapping(value = "", produces = {"application/json; charset=utf8"})
    public List<ParkingLotDto> deleteDataByIds(@RequestBody @Valid final List<String> ids) {
        return this.service.deleteByIds(ids);
    }*/

}
