using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace PARR.Domain.Entities
{
    [Table("Users")]
    [Index(nameof(Ip), IsUnique = true)]
    public class User : IBaseEntity
    {
        [Key]
        public Guid Id { get; set; }

        public DateTimeOffset DateCreated { get; set; }

        [NotMapped]
        public DateTimeOffset? DateModified { get; set; }

        public required string Ip { get; set; }

        public required string Name { get; set; }

        public string? Description { get; set; }

        public DateTimeOffset? LastLogon { get; set; }


        public ICollection<UsersInRole> Roles { get; set; } = new HashSet<UsersInRole>();
    }
}
