using adas_core.Application.Services.Interfaces;
using adas_core.Authentication.Attributes;
using adas_core.Domain.Enums;
using adas_core.Logging;
using Microsoft.AspNetCore.Mvc;

namespace adas_core.Controllers;

[Route("service-configs")]
[ApiController]
public class ServiceConfigController : ControllerBase
{
    private readonly IServiceConfigService _serviceConfigService;

    public ServiceConfigController(IServiceConfigService serviceConfigService)
    {
        LogExecutionContext.TrySetTraceIdentifier(Guid.NewGuid().ToString(), true);

        _serviceConfigService = serviceConfigService;
    }

    [HttpGet("{id}")]
    [AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)]
    public async Task<IActionResult> Find(string id)
    {
        var serviceConfig = await _serviceConfigService.Get(id);
        return Ok(serviceConfig);
    }
}