package com.bio.bio_backend.domain.base.authgroup.controller;

import com.bio.bio_backend.domain.base.authgroup.dto.AuthGroupDto;
import com.bio.bio_backend.domain.base.authgroup.service.AuthGroupService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import lombok.extern.slf4j.Slf4j;
import io.swagger.v3.oas.annotations.tags.Tag;

import java.util.List;

@RestController
@RequestMapping("/auth_group")
@RequiredArgsConstructor
@Tag(name = "AuthGroup", description = "")
@Slf4j
public class AuthGroupController {

    private final AuthGroupService authGroupService;

    @PostMapping("/create")
    public AuthGroupDto create(@RequestBody AuthGroupDto authGroupDto) {
        return authGroupService.create(authGroupDto);
    }

    @GetMapping("/{id}")
    public AuthGroupDto getById(@PathVariable Long id) {
        return authGroupService.getById(id);
    }

    @GetMapping
    public List<AuthGroupDto> getAll() {
        return authGroupService.getAll();
    }

    @PutMapping("/{id}")
    public AuthGroupDto update(@PathVariable Long id, @RequestBody AuthGroupDto dto) {
        return authGroupService.update(id, dto);
    }

    @DeleteMapping("/{id}")
    public void delete(@PathVariable Long id) {
        authGroupService.delete(id);
    }
}
