using System;
using System.ComponentModel.DataAnnotations;

namespace HRD.LDAPService
{
    public class JwtRole
    {
        private string role;
        private string _group;

        public JwtRole(string role) : this(role, string.Empty)
        { }

        public JwtRole(string role, string group)
        {
            Role = role;
            Group = group;
        }

        [Required]
        public string Role { get => role; set => role = value; }

        [Required]
        public string Group
        {
            get => _group;

            //"dhr/" prefix should be removed
            set => _group = string.IsNullOrEmpty(value) ? string.Empty : value.Replace(@"DHR\", "", StringComparison.InvariantCultureIgnoreCase);
        }
    }
}