// Path: friendly-id-samples/friendly-id-contracts/src/main/java/com/devskiller/friendly_id/sample/contracts/domain/Bar.java
// @Data
// @AllArgsConstructor
// public class Bar {
// 
// 	private UUID id;
// 	private String name;
// 
// 	private Foo foo;
// 
// }
// 
// Path: friendly-id-samples/friendly-id-contracts/src/main/java/com/devskiller/friendly_id/sample/contracts/domain/Foo.java
// @Data
// @AllArgsConstructor
// public class Foo {
// 
// 	private UUID id;
// 	private String name;
// 
// }


import com.devskiller.friendly_id.sample.contracts.domain.Bar;
import com.devskiller.friendly_id.sample.contracts.domain.Foo;
import org.springframework.hateoas.server.ExposesResourceFor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
package com.devskiller.friendly_id.sample.contracts;



@RestController
@ExposesResourceFor(BarResource.class)
@RequestMapping("/foos/{fooId}/bars")
public class BarController {

	private final BarResourceAssembler assembler;

	public BarController(BarResourceAssembler assembler) {
		this.assembler = assembler;
	}

	@GetMapping("/{id}")
	public BarResource getBar(@PathVariable UUID fooId, @PathVariable UUID id) {
// Path: friendly-id-samples/friendly-id-contracts/src/main/java/com/devskiller/friendly_id/sample/contracts/domain/Bar.java
// @Data
// @AllArgsConstructor
// public class Bar {
// 
// 	private UUID id;
// 	private String name;
// 
// 	private Foo foo;
// 
// }
// 
// Path: friendly-id-samples/friendly-id-contracts/src/main/java/com/devskiller/friendly_id/sample/contracts/domain/Foo.java
// @Data
// @AllArgsConstructor
// public class Foo {
// 
// 	private UUID id;
// 	private String name;
// 
// }


// Path: friendly-id-samples/friendly-id-contracts/src/main/java/com/devskiller/friendly_id/sample/contracts/BarController.java
import com.devskiller.friendly_id.sample.contracts.domain.Bar;
import com.devskiller.friendly_id.sample.contracts.domain.Foo;
import org.springframework.hateoas.server.ExposesResourceFor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;

package com.devskiller.friendly_id.sample.contracts;



@RestController
@ExposesResourceFor(BarResource.class)
@RequestMapping("/foos/{fooId}/bars")
public class BarController {

	private final BarResourceAssembler assembler;

	public BarController(BarResourceAssembler assembler) {
		this.assembler = assembler;
	}

	@GetMapping("/{id}")
	public BarResource getBar(@PathVariable UUID fooId, @PathVariable UUID id) {
		return assembler.toModel(new Bar(id, "Bar", new Foo(fooId, "Root Foo")));