using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Jellyfin.Data.Entities.Security
{
///
/// An entity representing an API key.
///
public class ApiKey
{
///
/// Initializes a new instance of the class.
///
/// The name.
public ApiKey(string name)
{
Name = name;
AccessToken = Guid.NewGuid();
DateCreated = DateTime.UtcNow;
}
///
/// Gets the id.
///
///
/// Identity, Indexed, Required.
///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; private set; }
///
/// Gets the date created.
///
public DateTime DateCreated { get; private set; }
///
/// Gets or sets the name.
///
[MaxLength(64)]
[StringLength(64)]
public string Name { get; set; }
///
/// Gets or sets the access token.
///
public Guid AccessToken { get; set; }
}
}