package dev.ksan.etfoglasiserver.controller;

import dev.ksan.etfoglasiserver.model.Subject;
import dev.ksan.etfoglasiserver.service.SubjectService;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
public class SubjectController {
  @Autowired SubjectService service;

  @GetMapping("/subjects")
  public List<Subject> getSubjects() {
    return service.getSubjects();
  }

  @GetMapping("/subjects/{subjectId}")
  public Subject getSubject(@PathVariable UUID subjectId) {
    return service.getSubject(subjectId);
  }


  @PostMapping("/subjects")
  public void addSubject(@RequestBody Subject subject) {
    service.addSubject(subject);
  }

//TODO uncomment this if ever roles are added so only admin should modify this (didnt really feel like doing it rn)
//
//  @PutMapping("/subjects")
//  public void updateSubject(@RequestBody Subject subject) {
//    service.updateSubject(subject);
//  }

//  @DeleteMapping("/subjects/{subjectId}")
//  public void deleteSubject(@PathVariable UUID subjectId) {
//    service.deleteSubject(subjectId);
//  }
}
