namespace OpenArchival.Blazor; using Microsoft.IdentityModel.Tokens; using OpenArchival.DataAccess; using System.ComponentModel.DataAnnotations; public class ArtifactEntryValidationModel : IValidatableObject { [Required(AllowEmptyStrings = false, ErrorMessage = "An artifact numbering must be supplied")] public string? ArtifactNumber { get; set; } [Required(AllowEmptyStrings = false, ErrorMessage = "A title must be provided")] public required string Title { get; set; } public string? Description { get; set; } public string? Type { get; set; } public required string? StorageLocation { get; set; } public List? Tags { get; set; } = []; public List? ListedNames { get; set; } = []; public List? AssociatedDates { get; set; } = []; public List? Defects { get; set; } = []; public List? Links { get; set; } = []; public string? ArtifactType { get; set; } public List? Files { get; set; } = []; public Dictionary? FileTextContent { get; set; } = []; public IEnumerable Validate(ValidationContext context) { if (Links.IsNullOrEmpty() && Files.IsNullOrEmpty()) { yield return new ValidationResult( "Either uploaded files or add content links", new[] {nameof(Links), nameof(Files)} ); } } public bool IsPublicallyVisible { get; set; } }