package com.example.test.rest_controllers;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.test.pojo.Layout;
import com.example.test.services.ModelHandleService;

@RestController
@RequestMapping("/api")
public class OpenModelController {
	
	private final ModelHandleService modelService;
	
	OpenModelController(ModelHandleService oms){
		this.modelService = oms;
	}

	@PostMapping("/open_model")
	public void openModel(@RequestParam("path") String path) {
		modelService.openModel(path);
	}
	
	@PostMapping("/layout_json")
	public void layoutJson(@RequestBody Layout l) {
		modelService.loadLayout(l);
	}
	
	
}




