using DigitalData.UserManager.API.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;

namespace DigitalData.UserManager.API.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ConstantsController : ControllerBase
    {
        private readonly Constants _constants;
        public ConstantsController(IOptions<Constants> constantsOptions)
        {
            _constants = constantsOptions.Value;
        }

        [HttpGet]
        public IActionResult GetConstant(string? name = null)
        {
            if(name is null)
                return Ok(_constants);


            return Ok(_constants[name]);
        }
    }
}