package org.egl_cepgl.pm.controller.admin;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.egl_cepgl.pm.dto.ProjectDto;
import org.egl_cepgl.pm.model.CustomModel;
import org.egl_cepgl.pm.model.Project;
import org.egl_cepgl.pm.service.CustomService;
import org.egl_cepgl.pm.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@Api("api/admin/customs")
@RestController
@RequestMapping("api/admin/objects")
public class CustomController
{
    private CustomService customService;

    @Autowired
    public CustomController(CustomService customService) {
        this.customService = customService;
    }

    @GetMapping(value = "/all",produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value="List ..", notes="Cette méthode permet..", responseContainer = "List<CustomModel>")
    @ApiResponses(value= { @ApiResponse(code= 200, message = "Une liste des ..") })
    public ResponseEntity<?> findAll(@RequestParam(required = true) String modelType)
    {
        return ResponseEntity.ok(customService.findAll(modelType));
    }
}
