using Baya.Domain.Common;
using Microsoft.AspNetCore.Identity;

namespace Baya.Domain.Entities.User;

public class UserRole : IdentityUserRole<int>,IEntity
{
    public User User { get; set; }
    public Role Role { get; set; }
    public DateTime CreatedUserRoleDate { get; set; }

    /// <summary>Who granted the role — the user themself for the public customer/nurse self-select,
    /// an admin for internal RBAC grants. NULL for legacy/seeded rows.</summary>
    public int? GrantedById { get; set; }
    public DateTimeOffset GrantedAt { get; set; }

    /// <summary>A revoked grant is kept as history (global query filter hides it from role reads).</summary>
    public DateTimeOffset? RevokedAt { get; set; }
}