// Path: src/main/java/com/edwise/completespring/assemblers/FooResource.java
// @Getter
// @Setter
// @Accessors(chain = true)
// public class FooResource extends ResourceSupport {
//     private Foo foo;
// }
// 
// Path: src/main/java/com/edwise/completespring/assemblers/FooResourceAssembler.java
// @Component
// public class FooResourceAssembler extends ResourceAssemblerSupport<Foo, FooResource> {
// 
//     public FooResourceAssembler() {
//         super(FooController.class, FooResource.class);
//     }
// 
//     @Override
//     protected FooResource instantiateResource(Foo foo) {
//         FooResource fooResource = super.instantiateResource(foo);
//         fooResource.setFoo(foo);
// 
//         return fooResource;
//     }
// 
//     public FooResource toResource(Foo foo) {
//         return this.createResourceWithId(foo.getId(), foo);
//     }
// }
// 
// Path: src/main/java/com/edwise/completespring/entities/Foo.java
// @ApiModel(value = "Foo entity", description = "Complete info of a entity foo")
// @Data
// @Accessors(chain = true)
// @EqualsAndHashCode(exclude = {"id"}, doNotUseGetters = true)
// @ToString(doNotUseGetters = true)
// public class Foo {
// 
//     @ApiModelProperty(value = "Sample Id Attribute", required = true)
//     private Long id;
// 
//     @ApiModelProperty(value = "Sample Text Attribute", required = true)
//     @NotNull
//     private String sampleTextAttribute;
// 
//     @ApiModelProperty(value = "Sample Local Date Attribute", required = true, dataType = "LocalDate")
//     @NotNull
//     private LocalDate sampleLocalDateAttribute;
// 
//     public Foo copyFrom(Foo other) {
//         this.sampleTextAttribute = other.sampleTextAttribute;
//         this.sampleLocalDateAttribute = other.sampleLocalDateAttribute;
// 
//         return this;
//     }
// }
// 
// Path: src/main/java/com/edwise/completespring/exceptions/InvalidRequestException.java
// public class InvalidRequestException extends RuntimeException {
// 
//     @Getter
//     private final ErrorInfo errors;
// 
//     public InvalidRequestException(BindingResult bindingResultErrors) {
//         super(bindingResultErrors.toString());
//         this.errors = ErrorInfo.generateErrorInfoFromBindingResult(bindingResultErrors);
//     }
// 
// }


import com.edwise.completespring.assemblers.FooResource;
import com.edwise.completespring.assemblers.FooResourceAssembler;
import com.edwise.completespring.entities.Foo;
import com.edwise.completespring.exceptions.InvalidRequestException;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.Link;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
        log.info("Foo found: {}", resource.getFoo());
        return new ResponseEntity<>(resource, HttpStatus.OK);
    }

    @ResponseStatus(HttpStatus.CREATED)
    @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE,
            consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "Create Foo", notes = "Create a foo")
    @ApiResponses({
            @ApiResponse(code = RESPONSE_CODE_CREATED, message = "Successful create of a foo")
    })
    public ResponseEntity<FooResource> createFoo(@Valid @RequestBody Foo foo, BindingResult errors) {
        if (errors.hasErrors()) {
            throw new InvalidRequestException(errors);
        }
        log.info("Foo created: {}", foo.toString());
        return new ResponseEntity<>(createHttpHeadersWithLocation(foo.setId(1L)), HttpStatus.CREATED);
    }

    @ResponseStatus(HttpStatus.NO_CONTENT)
    @RequestMapping(method = RequestMethod.PUT, value = "{id}", produces = MediaType.APPLICATION_JSON_VALUE,
            consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "Update Foo", notes = "Update a foo")
    @ApiResponses({
            @ApiResponse(code = RESPONSE_CODE_NO_RESPONSE, message = "Successful update of foo")
    })
    public void updateFoo(@ApiParam(defaultValue = "1", value = "The id of the foo to update")
                          @PathVariable long id,
                          @Valid @RequestBody Foo foo, BindingResult errors) {
        if (errors.hasErrors()) {
// Path: src/main/java/com/edwise/completespring/assemblers/FooResource.java
// @Getter
// @Setter
// @Accessors(chain = true)
// public class FooResource extends ResourceSupport {
//     private Foo foo;
// }
// 
// Path: src/main/java/com/edwise/completespring/assemblers/FooResourceAssembler.java
// @Component
// public class FooResourceAssembler extends ResourceAssemblerSupport<Foo, FooResource> {
// 
//     public FooResourceAssembler() {
//         super(FooController.class, FooResource.class);
//     }
// 
//     @Override
//     protected FooResource instantiateResource(Foo foo) {
//         FooResource fooResource = super.instantiateResource(foo);
//         fooResource.setFoo(foo);
// 
//         return fooResource;
//     }
// 
//     public FooResource toResource(Foo foo) {
//         return this.createResourceWithId(foo.getId(), foo);
//     }
// }
// 
// Path: src/main/java/com/edwise/completespring/entities/Foo.java
// @ApiModel(value = "Foo entity", description = "Complete info of a entity foo")
// @Data
// @Accessors(chain = true)
// @EqualsAndHashCode(exclude = {"id"}, doNotUseGetters = true)
// @ToString(doNotUseGetters = true)
// public class Foo {
// 
//     @ApiModelProperty(value = "Sample Id Attribute", required = true)
//     private Long id;
// 
//     @ApiModelProperty(value = "Sample Text Attribute", required = true)
//     @NotNull
//     private String sampleTextAttribute;
// 
//     @ApiModelProperty(value = "Sample Local Date Attribute", required = true, dataType = "LocalDate")
//     @NotNull
//     private LocalDate sampleLocalDateAttribute;
// 
//     public Foo copyFrom(Foo other) {
//         this.sampleTextAttribute = other.sampleTextAttribute;
//         this.sampleLocalDateAttribute = other.sampleLocalDateAttribute;
// 
//         return this;
//     }
// }
// 
// Path: src/main/java/com/edwise/completespring/exceptions/InvalidRequestException.java
// public class InvalidRequestException extends RuntimeException {
// 
//     @Getter
//     private final ErrorInfo errors;
// 
//     public InvalidRequestException(BindingResult bindingResultErrors) {
//         super(bindingResultErrors.toString());
//         this.errors = ErrorInfo.generateErrorInfoFromBindingResult(bindingResultErrors);
//     }
// 
// }


// Path: src/main/java/com/edwise/completespring/controllers/FooController.java
import com.edwise.completespring.assemblers.FooResource;
import com.edwise.completespring.assemblers.FooResourceAssembler;
import com.edwise.completespring.entities.Foo;
import com.edwise.completespring.exceptions.InvalidRequestException;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.Link;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;

        log.info("Foo found: {}", resource.getFoo());
        return new ResponseEntity<>(resource, HttpStatus.OK);
    }

    @ResponseStatus(HttpStatus.CREATED)
    @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE,
            consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "Create Foo", notes = "Create a foo")
    @ApiResponses({
            @ApiResponse(code = RESPONSE_CODE_CREATED, message = "Successful create of a foo")
    })
    public ResponseEntity<FooResource> createFoo(@Valid @RequestBody Foo foo, BindingResult errors) {
        if (errors.hasErrors()) {
            throw new InvalidRequestException(errors);
        }
        log.info("Foo created: {}", foo.toString());
        return new ResponseEntity<>(createHttpHeadersWithLocation(foo.setId(1L)), HttpStatus.CREATED);
    }

    @ResponseStatus(HttpStatus.NO_CONTENT)
    @RequestMapping(method = RequestMethod.PUT, value = "{id}", produces = MediaType.APPLICATION_JSON_VALUE,
            consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "Update Foo", notes = "Update a foo")
    @ApiResponses({
            @ApiResponse(code = RESPONSE_CODE_NO_RESPONSE, message = "Successful update of foo")
    })
    public void updateFoo(@ApiParam(defaultValue = "1", value = "The id of the foo to update")
                          @PathVariable long id,
                          @Valid @RequestBody Foo foo, BindingResult errors) {
        if (errors.hasErrors()) {
            throw new InvalidRequestException(errors);