using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Jellyfin.Data.Interfaces;
namespace Jellyfin.Data.Entities.Libraries
{
///
/// An entity representing a company.
///
public class Company : IHasCompanies, IHasConcurrencyToken
{
///
/// Initializes a new instance of the class.
///
/// The owner of this company.
public Company(IHasCompanies owner)
{
owner?.Companies.Add(this);
CompanyMetadata = new HashSet();
}
///
/// Initializes a new instance of the class.
///
///
/// Default constructor. Protected due to required properties, but present because EF needs it.
///
protected Company()
{
}
///
/// Gets or sets the id.
///
///
/// Identity, Indexed, Required.
///
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; protected set; }
///
[ConcurrencyCheck]
public uint RowVersion { get; set; }
///
/// Gets or sets a collection containing the metadata.
///
public virtual ICollection CompanyMetadata { get; protected set; }
///
/// Gets or sets a collection containing this company's child companies.
///
public virtual ICollection ChildCompanies { get; protected set; }
///
[NotMapped]
public ICollection Companies => ChildCompanies;
///
public void OnSavingChanges()
{
RowVersion++;
}
}
}