// Path: src/main/java/com/parrit/DTOs/RolePositionDTO.java
// @Getter
// @Setter
// @EqualsAndHashCode
// public class RolePositionDTO {
// 
//     @NotNull(message = "Where are you trying to go? Roles must be with a pairing board!")
//     private Long pairingBoardId;
// 
// }
// 
// Path: src/main/java/com/parrit/entities/PairingBoard.java
// @Entity
// @Table(name = "pairing_board",
//         indexes = {
//                 @Index(name = "pairing_board_pkey", unique = true, columnList = "id")
//         }
// )
// @Getter
// @Setter
// @NoArgsConstructor
// @EqualsAndHashCode
// @ToString
// public class PairingBoard {
// 
//     @Id
//     @Column(name = "id", nullable = false)
//     @ColumnDefault("nextval('pairing_board_id_seq')")
//     @SequenceGenerator(name = "pairing_board_id_gen", sequenceName = "pairing_board_id_seq", initialValue = 1, allocationSize = 1)
//     @GeneratedValue(generator = "pairing_board_id_gen", strategy = GenerationType.SEQUENCE)
//     private long id;
// 
//     @Column(name = "name", nullable = false, length = 255)
//     private String name;
// 
//     @Column(name = "exempt", nullable = false)
//     private boolean exempt;
// 
//     @OneToMany
//     @JoinColumn(name = "pairing_board_id", nullable = true, foreignKey = @ForeignKey(name = "pairing_board_id_fk"))
//     private List<Person> people = new ArrayList<>();
// 
//     @OneToMany(cascade = CascadeType.ALL)
//     @JoinColumn(name = "pairing_board_id", nullable = false, foreignKey = @ForeignKey(name = "pairing_board_id_fk"))
//     private List<Role> roles = new ArrayList<>();
// 
//     public PairingBoard(String name, boolean exempt, List<Person> people, List<Role> roles) {
//         this.name = name;
//         this.exempt = exempt;
//         this.people = people;
//         this.roles = roles;
//     }
// 
// }
// 
// Path: src/main/java/com/parrit/entities/Role.java
// @Entity
// @Table(name = "role",
//         indexes = {
//                 @Index(name = "role_pkey", unique = true, columnList = "id")
//         }
// )
// @NoArgsConstructor
// @Getter
// @Setter
// @EqualsAndHashCode
// @ToString
// public class Role {
// 
//     @Id
//     @Column(name = "id", nullable = false)
//     @ColumnDefault("nextval('role_id_seq')")
//     @SequenceGenerator(name = "role_id_gen", sequenceName = "role_id_seq", initialValue = 1, allocationSize = 1)
//     @GeneratedValue(generator = "role_id_gen", strategy = GenerationType.SEQUENCE)
//     private long id;
// 
//     @Column(name = "name", nullable = false, length = 255)
//     private String name;
// 
//     public Role(String name) {
//         this.name = name;
//     }
// 
// }
// 
// Path: src/main/java/com/parrit/exceptions/PairingBoardPositionNotFoundException.java
// public class PairingBoardPositionNotFoundException extends RuntimeException {
// 
//     public PairingBoardPositionNotFoundException(String msg) {
//         super(msg);
//     }
// }
// 
// Path: src/main/java/com/parrit/repositories/ProjectRepository.java
// @Repository
// public interface ProjectRepository extends JpaRepository<Project, Long> {
// 
//     Optional<Project> findByName(String name);
// 
// }
// 
// Path: src/main/java/com/parrit/repositories/RoleRepository.java
// @Repository
// public interface RoleRepository extends JpaRepository<Role, Long> {
// 
// }


import com.parrit.DTOs.ProjectDTO;
import com.parrit.DTOs.RoleDTO;
import com.parrit.DTOs.RolePositionDTO;
import com.parrit.entities.PairingBoard;
import com.parrit.entities.Project;
import com.parrit.entities.Role;
import com.parrit.exceptions.PairingBoardNotFoundException;
import com.parrit.exceptions.PairingBoardPositionNotFoundException;
import com.parrit.exceptions.RoleNotFoundException;
import com.parrit.repositories.ProjectRepository;
import com.parrit.repositories.RoleRepository;
import com.parrit.transformers.ProjectTransformer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
package com.parrit.controllers;



@RestController
public class RoleController {

    private final ProjectRepository projectRepository;
    private final RoleRepository roleRepository;

    @Autowired
// Path: src/main/java/com/parrit/DTOs/RolePositionDTO.java
// @Getter
// @Setter
// @EqualsAndHashCode
// public class RolePositionDTO {
// 
//     @NotNull(message = "Where are you trying to go? Roles must be with a pairing board!")
//     private Long pairingBoardId;
// 
// }
// 
// Path: src/main/java/com/parrit/entities/PairingBoard.java
// @Entity
// @Table(name = "pairing_board",
//         indexes = {
//                 @Index(name = "pairing_board_pkey", unique = true, columnList = "id")
//         }
// )
// @Getter
// @Setter
// @NoArgsConstructor
// @EqualsAndHashCode
// @ToString
// public class PairingBoard {
// 
//     @Id
//     @Column(name = "id", nullable = false)
//     @ColumnDefault("nextval('pairing_board_id_seq')")
//     @SequenceGenerator(name = "pairing_board_id_gen", sequenceName = "pairing_board_id_seq", initialValue = 1, allocationSize = 1)
//     @GeneratedValue(generator = "pairing_board_id_gen", strategy = GenerationType.SEQUENCE)
//     private long id;
// 
//     @Column(name = "name", nullable = false, length = 255)
//     private String name;
// 
//     @Column(name = "exempt", nullable = false)
//     private boolean exempt;
// 
//     @OneToMany
//     @JoinColumn(name = "pairing_board_id", nullable = true, foreignKey = @ForeignKey(name = "pairing_board_id_fk"))
//     private List<Person> people = new ArrayList<>();
// 
//     @OneToMany(cascade = CascadeType.ALL)
//     @JoinColumn(name = "pairing_board_id", nullable = false, foreignKey = @ForeignKey(name = "pairing_board_id_fk"))
//     private List<Role> roles = new ArrayList<>();
// 
//     public PairingBoard(String name, boolean exempt, List<Person> people, List<Role> roles) {
//         this.name = name;
//         this.exempt = exempt;
//         this.people = people;
//         this.roles = roles;
//     }
// 
// }
// 
// Path: src/main/java/com/parrit/entities/Role.java
// @Entity
// @Table(name = "role",
//         indexes = {
//                 @Index(name = "role_pkey", unique = true, columnList = "id")
//         }
// )
// @NoArgsConstructor
// @Getter
// @Setter
// @EqualsAndHashCode
// @ToString
// public class Role {
// 
//     @Id
//     @Column(name = "id", nullable = false)
//     @ColumnDefault("nextval('role_id_seq')")
//     @SequenceGenerator(name = "role_id_gen", sequenceName = "role_id_seq", initialValue = 1, allocationSize = 1)
//     @GeneratedValue(generator = "role_id_gen", strategy = GenerationType.SEQUENCE)
//     private long id;
// 
//     @Column(name = "name", nullable = false, length = 255)
//     private String name;
// 
//     public Role(String name) {
//         this.name = name;
//     }
// 
// }
// 
// Path: src/main/java/com/parrit/exceptions/PairingBoardPositionNotFoundException.java
// public class PairingBoardPositionNotFoundException extends RuntimeException {
// 
//     public PairingBoardPositionNotFoundException(String msg) {
//         super(msg);
//     }
// }
// 
// Path: src/main/java/com/parrit/repositories/ProjectRepository.java
// @Repository
// public interface ProjectRepository extends JpaRepository<Project, Long> {
// 
//     Optional<Project> findByName(String name);
// 
// }
// 
// Path: src/main/java/com/parrit/repositories/RoleRepository.java
// @Repository
// public interface RoleRepository extends JpaRepository<Role, Long> {
// 
// }


// Path: src/main/java/com/parrit/controllers/RoleController.java
import com.parrit.DTOs.ProjectDTO;
import com.parrit.DTOs.RoleDTO;
import com.parrit.DTOs.RolePositionDTO;
import com.parrit.entities.PairingBoard;
import com.parrit.entities.Project;
import com.parrit.entities.Role;
import com.parrit.exceptions.PairingBoardNotFoundException;
import com.parrit.exceptions.PairingBoardPositionNotFoundException;
import com.parrit.exceptions.RoleNotFoundException;
import com.parrit.repositories.ProjectRepository;
import com.parrit.repositories.RoleRepository;
import com.parrit.transformers.ProjectTransformer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;

package com.parrit.controllers;



@RestController
public class RoleController {

    private final ProjectRepository projectRepository;
    private final RoleRepository roleRepository;

    @Autowired
    public RoleController(ProjectRepository projectRepository, RoleRepository roleRepository) {