| | 1 | | using System.Diagnostics.CodeAnalysis; |
| | 2 | | using System.Text.Json.Serialization; |
| | 3 | | using Spdx3.Model.Core.Enums; |
| | 4 | | using Spdx3.Model.Lite; |
| | 5 | | using Spdx3.Serialization; |
| | 6 | | using Spdx3.Utility; |
| | 7 | |
|
| | 8 | | // ReSharper disable UnusedMember.Global |
| | 9 | |
|
| | 10 | | namespace Spdx3.Model.Core.Classes; |
| | 11 | |
|
| | 12 | | /// <summary> |
| | 13 | | /// A reference to a resource identifier defined outside the scope of SPDX-3.0 content that uniquely identifies an |
| | 14 | | /// Element. |
| | 15 | | /// See https://spdx.github.io/spdx-spec/v3.0.1/model/Core/Classes/ExternalIdentifier/ |
| | 16 | | /// </summary> |
| | 17 | | public class ExternalIdentifier : BaseModelClass, ILiteDomainCompliantElement |
| | 18 | | { |
| | 19 | | [JsonPropertyName("comment")] |
| | 20 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 10 | 21 | | public string? Comment { get; set; } |
| | 22 | |
|
| | 23 | | [JsonPropertyName("externalIdentifierType")] |
| | 24 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 62 | 25 | | public required ExternalIdentifierType ExternalIdentifierType { get; set; } |
| | 26 | |
|
| | 27 | | [JsonPropertyName("identifier")] |
| | 28 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 64 | 29 | | public required string Identifier { get; set; } |
| | 30 | |
|
| | 31 | | [JsonPropertyName("identifierLocator")] |
| | 32 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 62 | 33 | | public IList<Uri> IdentifierLocator { get; } = new List<Uri>(); |
| | 34 | |
|
| | 35 | | [JsonPropertyName("issuingAuthority")] |
| | 36 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 10 | 37 | | public string? IssuingAuthority { get; set; } |
| | 38 | |
|
| | 39 | | // protected internal no-parm constructor required for deserialization |
| 5 | 40 | | protected internal ExternalIdentifier() |
| | 41 | | { |
| 5 | 42 | | } |
| | 43 | |
|
| | 44 | | [SetsRequiredMembers] |
| | 45 | | public ExternalIdentifier(Catalog catalog, ExternalIdentifierType externalIdentifierType, string identifier) : |
| 42 | 46 | | base(catalog) |
| | 47 | | { |
| 42 | 48 | | ExternalIdentifierType = externalIdentifierType; |
| 42 | 49 | | Identifier = identifier; |
| 42 | 50 | | } |
| | 51 | |
|
| | 52 | | public override void Validate() |
| | 53 | | { |
| 5 | 54 | | base.Validate(); |
| 4 | 55 | | ValidateRequiredProperty(nameof(Identifier)); |
| 2 | 56 | | ValidateRequiredProperty(nameof(ExternalIdentifierType)); |
| 2 | 57 | | } |
| | 58 | |
|
| | 59 | | public void Accept(ILiteDomainComplianceVisitor visitor) |
| | 60 | | { |
| 2 | 61 | | visitor.Visit(this); |
| 2 | 62 | | } |
| | 63 | | } |