namespace ZB.MOM.WW.ScadaBridge.Commons.Entities.Security;

public class LdapGroupMapping
{
    /// <summary>Gets or sets the primary key.</summary>
    public int Id { get; set; }
    /// <summary>Gets or sets the LDAP/AD group CN that this mapping targets.</summary>
    public string LdapGroupName { get; set; }
    /// <summary>Gets or sets the ScadaBridge role name this group maps to.</summary>
    public string Role { get; set; }

    // Parameterless constructor for EF Core seed data
    private LdapGroupMapping() { LdapGroupName = null!; Role = null!; }

    /// <summary>Initializes a new <see cref="LdapGroupMapping"/> linking an LDAP group to a ScadaBridge role.</summary>
    /// <param name="ldapGroupName">The LDAP group name (CN).</param>
    /// <param name="role">The ScadaBridge role name to assign.</param>
    public LdapGroupMapping(string ldapGroupName, string role)
    {
        LdapGroupName = ldapGroupName ?? throw new ArgumentNullException(nameof(ldapGroupName));
        Role = role ?? throw new ArgumentNullException(nameof(role));
    }
}
