/****************************************************************************** // MARECHAI: Master repository of computing history artifacts information // ---------------------------------------------------------------------------- // // Author(s) : Natalia Portillo // // --[ License ] -------------------------------------------------------------- // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // ---------------------------------------------------------------------------- // Copyright © 2003-2026 Natalia Portillo *******************************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using Marechai.Data; namespace Marechai.Database.Models; public class Company : BaseModel { public Company() { Logos = new HashSet(); Gpus = new HashSet(); InverseSoldToNavigation = new HashSet(); MachineFamilies = new HashSet(); Machines = new HashSet(); Processors = new HashSet(); SoundSynths = new HashSet(); } [Required] public string Name { get; set; } [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)] [DataType(DataType.Date)] public DateTime? Founded { get; set; } [Url] [StringLength(255)] public string Website { get; set; } [StringLength(45)] public string Twitter { get; set; } [StringLength(45)] public string Facebook { get; set; } [DisplayFormat(DataFormatString = "{0:d}")] [DataType(DataType.Date)] public DateTime? Sold { get; set; } public int? SoldToId { get; set; } [StringLength(80)] public string Address { get; set; } [StringLength(80)] public string City { get; set; } [StringLength(80)] public string Province { get; set; } [StringLength(25)] [DisplayName("Postal code")] public string PostalCode { get; set; } public short? CountryId { get; set; } [Required] public CompanyStatus Status { get; set; } public int? DocumentCompanyId { get; set; } [DefaultValue(false)] public bool FoundedMonthIsUnknown { get; set; } [DefaultValue(false)] public bool FoundedDayIsUnknown { get; set; } [DefaultValue(false)] public bool SoldMonthIsUnknown { get; set; } [DefaultValue(false)] public bool SoldDayIsUnknown { get; set; } public string LegalName { get; set; } public virtual Iso31661Numeric Country { get; set; } [DisplayName("Sold to")] public virtual Company SoldTo { get; set; } public virtual ICollection Descriptions { get; set; } public virtual ICollection Logos { get; set; } public virtual ICollection Gpus { get; set; } public virtual ICollection InverseSoldToNavigation { get; set; } public virtual ICollection MachineFamilies { get; set; } public virtual ICollection Machines { get; set; } public virtual ICollection Processors { get; set; } public virtual ICollection SoundSynths { get; set; } public virtual ICollection People { get; set; } public virtual CompanyLogo LastLogo => Logos?.OrderByDescending(l => l.Year).FirstOrDefault(); public virtual DocumentCompany DocumentCompany { get; set; } public virtual ICollection SoftwareFamilies { get; set; } public virtual ICollection SoftwareVersions { get; set; } public virtual ICollection SoftwareVariants { get; set; } }