// Path: springboot-angularjs-crud-app/src/main/java/org/fabhotels/servicerequestapp/constants/ServiceRequestStatus.java
// public enum ServiceRequestStatus {
//     RESOLVED, PENDING
// }
// 
// Path: springboot-angularjs-crud-app/src/main/java/org/fabhotels/servicerequestapp/model/ServiceRequest.java
// @Entity
// public class ServiceRequest {
// 
//     @Id
//     @GeneratedValue
//     private long id;
// 
//     @Column
//     private String title;
// 
//     @Column
//     private String description;
// 
//     @Column
//     @Enumerated(STRING)
//     private ServiceRequestStatus status = PENDING;
// 
//     // As of now keeping as a string but needs to be fetched from master data
//     @Column
//     private String hotel;
// 
//     // As of now keeping as a string but needs to be fetched from master data
//     @Column
//     private String roomNo;
// 
//     @Column
//     private String customerName;
// 
//     @Column
//     @Temporal(TIMESTAMP)
//     private Date requestTime = new Date();
// 
//     public ServiceRequest() {
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public ServiceRequestStatus getStatus() {
//         return status;
//     }
// 
//     public void setStatus(ServiceRequestStatus status) {
//         this.status = status;
//     }
// 
//     public String getHotel() {
//         return hotel;
//     }
// 
//     public void setHotel(String hotel) {
//         this.hotel = hotel;
//     }
// 
//     public String getRoomNo() {
//         return roomNo;
//     }
// 
//     public void setRoomNo(String roomNo) {
//         this.roomNo = roomNo;
//     }
// 
//     public String getCustomerName() {
//         return customerName;
//     }
// 
//     public void setCustomerName(String customerName) {
//         this.customerName = customerName;
//     }
// 
//     public Date getRequestTime() {
//         return requestTime;
//     }
// 
//     public void setRequestTime(Date requestTime) {
//         this.requestTime = requestTime;
//     }
// 
//     @Override
//     public String toString() {
//         return "ServiceRequest{" +
//                 "id=" + id +
//                 ", title='" + title + '\'' +
//                 ", description='" + description + '\'' +
//                 ", status=" + status +
//                 ", hotel='" + hotel + '\'' +
//                 ", roomNo='" + roomNo + '\'' +
//                 ", customerName='" + customerName + '\'' +
//                 ", requestTime=" + requestTime +
//                 '}';
//     }
// 
// }
// 
// Path: springboot-angularjs-crud-app/src/main/java/org/fabhotels/servicerequestapp/service/ServiceRequestService.java
// public interface ServiceRequestService {
// 
//     ServiceRequest save(ServiceRequest request);
// 
//     ServiceRequest getById(long id);
// 
//     Collection<ServiceRequest> getByStatus(ServiceRequestStatus status);
// 
//     Collection<ServiceRequest> getByCustomer(String customerId);
// 
//     Collection<ServiceRequest> getAll();
// 
//     ServiceRequest solveRequest(long id);
// 
// }


import org.fabhotels.servicerequestapp.constants.ServiceRequestStatus;
import org.fabhotels.servicerequestapp.model.ServiceRequest;
import org.fabhotels.servicerequestapp.service.ServiceRequestService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Collection;
import static org.springframework.web.bind.annotation.RequestMethod.*;
package org.fabhotels.servicerequestapp.controller;




/**
 * @author Naresh Joshi
 */

@RestController
@RequestMapping(value = "/api/service/request")
@CrossOrigin(origins = "*", allowedHeaders = "*", methods = {GET, POST, PUT, DELETE, OPTIONS})
public class ServiceRequestController {

    @Resource
    ServiceRequestService serviceRequestService;

    @PostMapping
    public ServiceRequest save(@RequestBody @Valid ServiceRequest request) {
        return serviceRequestService.save(request);
    }

// Path: springboot-angularjs-crud-app/src/main/java/org/fabhotels/servicerequestapp/constants/ServiceRequestStatus.java
// public enum ServiceRequestStatus {
//     RESOLVED, PENDING
// }
// 
// Path: springboot-angularjs-crud-app/src/main/java/org/fabhotels/servicerequestapp/model/ServiceRequest.java
// @Entity
// public class ServiceRequest {
// 
//     @Id
//     @GeneratedValue
//     private long id;
// 
//     @Column
//     private String title;
// 
//     @Column
//     private String description;
// 
//     @Column
//     @Enumerated(STRING)
//     private ServiceRequestStatus status = PENDING;
// 
//     // As of now keeping as a string but needs to be fetched from master data
//     @Column
//     private String hotel;
// 
//     // As of now keeping as a string but needs to be fetched from master data
//     @Column
//     private String roomNo;
// 
//     @Column
//     private String customerName;
// 
//     @Column
//     @Temporal(TIMESTAMP)
//     private Date requestTime = new Date();
// 
//     public ServiceRequest() {
//     }
// 
//     public long getId() {
//         return id;
//     }
// 
//     public void setId(long id) {
//         this.id = id;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public void setDescription(String description) {
//         this.description = description;
//     }
// 
//     public ServiceRequestStatus getStatus() {
//         return status;
//     }
// 
//     public void setStatus(ServiceRequestStatus status) {
//         this.status = status;
//     }
// 
//     public String getHotel() {
//         return hotel;
//     }
// 
//     public void setHotel(String hotel) {
//         this.hotel = hotel;
//     }
// 
//     public String getRoomNo() {
//         return roomNo;
//     }
// 
//     public void setRoomNo(String roomNo) {
//         this.roomNo = roomNo;
//     }
// 
//     public String getCustomerName() {
//         return customerName;
//     }
// 
//     public void setCustomerName(String customerName) {
//         this.customerName = customerName;
//     }
// 
//     public Date getRequestTime() {
//         return requestTime;
//     }
// 
//     public void setRequestTime(Date requestTime) {
//         this.requestTime = requestTime;
//     }
// 
//     @Override
//     public String toString() {
//         return "ServiceRequest{" +
//                 "id=" + id +
//                 ", title='" + title + '\'' +
//                 ", description='" + description + '\'' +
//                 ", status=" + status +
//                 ", hotel='" + hotel + '\'' +
//                 ", roomNo='" + roomNo + '\'' +
//                 ", customerName='" + customerName + '\'' +
//                 ", requestTime=" + requestTime +
//                 '}';
//     }
// 
// }
// 
// Path: springboot-angularjs-crud-app/src/main/java/org/fabhotels/servicerequestapp/service/ServiceRequestService.java
// public interface ServiceRequestService {
// 
//     ServiceRequest save(ServiceRequest request);
// 
//     ServiceRequest getById(long id);
// 
//     Collection<ServiceRequest> getByStatus(ServiceRequestStatus status);
// 
//     Collection<ServiceRequest> getByCustomer(String customerId);
// 
//     Collection<ServiceRequest> getAll();
// 
//     ServiceRequest solveRequest(long id);
// 
// }


// Path: springboot-angularjs-crud-app/src/main/java/org/fabhotels/servicerequestapp/controller/ServiceRequestController.java
import org.fabhotels.servicerequestapp.constants.ServiceRequestStatus;
import org.fabhotels.servicerequestapp.model.ServiceRequest;
import org.fabhotels.servicerequestapp.service.ServiceRequestService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Collection;
import static org.springframework.web.bind.annotation.RequestMethod.*;

package org.fabhotels.servicerequestapp.controller;




/**
 * @author Naresh Joshi
 */

@RestController
@RequestMapping(value = "/api/service/request")
@CrossOrigin(origins = "*", allowedHeaders = "*", methods = {GET, POST, PUT, DELETE, OPTIONS})
public class ServiceRequestController {

    @Resource
    ServiceRequestService serviceRequestService;

    @PostMapping
    public ServiceRequest save(@RequestBody @Valid ServiceRequest request) {
        return serviceRequestService.save(request);
    }

    @GetMapping("/{id}")