package com.zero4j.controller.api.v1;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.zero4j.model.area.service.AreaService;
@RestController
@RequestMapping("/api/v1/areas")
public class AreasApiControllerV1 {
@Autowired
private AreaService areaService;
@Autowired
private SessionFactory sessionFactory;
@Autowired
private RestTemplate restTemplate;
@PatchMapping(value="/{id}")
public ResponseEntity update(HttpServletRequest request,HttpServletResponse response,
@PathVariable(value="id") String id,
@RequestParam(required=false) String token,
@RequestParam(required=false) String name,
@RequestParam(required=false) String parentId,
@RequestParam(required=false) Boolean hasChildren
){
return ResponseEntity.ok((String)areaApiFeignClient.update(id,token,name,parentId,hasChildren));
}
}