| | 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 | | /// An assertion made in relation to one or more elements. |
| | 11 | | /// See https://spdx.github.io/spdx-spec/v3.0.1/model/Core/Classes/Annotation/ |
| | 12 | | /// </summary> |
| | 13 | | public class Annotation : Element |
| | 14 | | { |
| | 15 | | [JsonPropertyName("subject")] |
| | 16 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 17 | 17 | | public required Element Subject { get; set; } |
| | 18 | |
|
| | 19 | | [JsonPropertyName("annotationType")] |
| | 20 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 15 | 21 | | public required AnnotationType AnnotationType { get; set; } |
| | 22 | |
|
| | 23 | | [JsonPropertyName("statement")] |
| | 24 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 25 | | public string? Statement { get; set; } |
| | 26 | |
|
| | 27 | | [JsonPropertyName("contentType")] |
| | 28 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 29 | | public string? ContentType { get; set; } |
| | 30 | |
|
| | 31 | | // protected internal no-parm constructor required for deserialization |
| | 32 | | // ReSharper disable once UnusedMember.Global |
| 2 | 33 | | protected internal Annotation() |
| | 34 | | { |
| 2 | 35 | | } |
| | 36 | |
|
| | 37 | | [SetsRequiredMembers] |
| | 38 | | public Annotation(Catalog catalog, CreationInfo creationInfo, AnnotationType annotationType, Element subject) : |
| 4 | 39 | | base(catalog, creationInfo) |
| | 40 | | { |
| 4 | 41 | | AnnotationType = annotationType; |
| 4 | 42 | | Subject = subject; |
| 4 | 43 | | } |
| | 44 | |
|
| | 45 | | public override void Validate() |
| | 46 | | { |
| 5 | 47 | | base.Validate(); |
| 3 | 48 | | ValidateRequiredProperty(nameof(AnnotationType)); |
| 3 | 49 | | ValidateRequiredProperty(nameof(Subject)); |
| 3 | 50 | | } |
| | 51 | | } |