using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
    /// 
    /// An entity representing a metadata provider.
    /// 
    public class MetadataProvider : IHasConcurrencyToken
    {
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// The name of the metadata provider.
        public MetadataProvider(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            Name = name;
        }
        /// 
        /// Gets the id.
        /// 
        /// 
        /// Identity, Indexed, Required.
        /// 
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; private set; }
        /// 
        /// Gets or sets the name.
        /// 
        /// 
        /// Required, Max length = 1024.
        /// 
        [MaxLength(1024)]
        [StringLength(1024)]
        public string Name { get; set; }
        /// 
        [ConcurrencyCheck]
        public uint RowVersion { get; private set; }
        /// 
        public void OnSavingChanges()
        {
            RowVersion++;
        }
    }
}