| | 1 | | using System.Diagnostics.CodeAnalysis; |
| | 2 | | using System.Text.Json.Serialization; |
| | 3 | | using Spdx3.Model.Core.Enums; |
| | 4 | | using Spdx3.Serialization; |
| | 5 | | using Spdx3.Utility; |
| | 6 | |
|
| | 7 | | namespace Spdx3.Model.Core.Classes; |
| | 8 | |
|
| | 9 | | /// <summary> |
| | 10 | | /// A reference to a resource outside the scope of SPDX-3.0 content related to an Element. |
| | 11 | | /// See https://spdx.github.io/spdx-spec/v3.0.1/model/Core/Classes/ExternalRef/ |
| | 12 | | /// </summary> |
| | 13 | | public class ExternalRef : BaseModelClass |
| | 14 | | { |
| | 15 | | [JsonPropertyName("externalRefType")] |
| | 16 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 46 | 17 | | public required ExternalRefType ExternalRefType { get; set; } |
| | 18 | |
|
| | 19 | | [JsonPropertyName("locator")] |
| | 20 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 51 | 21 | | public IList<string> Locator { get; set; } = new List<string>(); |
| | 22 | |
|
| | 23 | | [JsonPropertyName("contentType")] |
| | 24 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 6 | 25 | | public string? ContentType { get; set; } |
| | 26 | |
|
| | 27 | | [JsonPropertyName("comment")] |
| | 28 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 6 | 29 | | public string? Comment { get; set; } |
| | 30 | |
|
| | 31 | | // protected internal no-parm constructor required for deserialization |
| | 32 | | // ReSharper disable once UnusedMember.Global |
| 2 | 33 | | protected internal ExternalRef() |
| | 34 | | { |
| 2 | 35 | | } |
| | 36 | |
|
| | 37 | | [SetsRequiredMembers] |
| 38 | 38 | | public ExternalRef(Catalog catalog, ExternalRefType externalRefType) : base(catalog) |
| | 39 | | { |
| 38 | 40 | | ExternalRefType = externalRefType; |
| 38 | 41 | | } |
| | 42 | |
|
| | 43 | | public override void Validate() |
| | 44 | | { |
| 3 | 45 | | base.Validate(); |
| 2 | 46 | | ValidateRequiredProperty(nameof(ExternalRefType)); |
| 2 | 47 | | } |
| | 48 | | } |