| | 1 | | using System.Diagnostics.CodeAnalysis; |
| | 2 | | using System.Text.Json.Serialization; |
| | 3 | | using Spdx3.Model.AI.Enums; |
| | 4 | | using Spdx3.Model.Core.Classes; |
| | 5 | | using Spdx3.Model.Core.Enums; |
| | 6 | | using Spdx3.Model.Software.Classes; |
| | 7 | | using Spdx3.Model.Software.Enums; |
| | 8 | | using Spdx3.Serialization; |
| | 9 | | using Spdx3.Utility; |
| | 10 | |
|
| | 11 | | namespace Spdx3.Model.AI.Classes; |
| | 12 | |
|
| | 13 | | public class AiPackage : Package |
| | 14 | | { |
| | 15 | | [JsonPropertyName("releaseTime")] |
| | 16 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 17 | | public new required DateTimeOffset ReleaseTime { get; set; } |
| | 18 | |
|
| | 19 | | [JsonPropertyName("suppliedBy")] |
| | 20 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 9 | 21 | | public new required Agent SuppliedBy { get; set; } |
| | 22 | |
|
| | 23 | | [JsonPropertyName("software_downloadLocation")] |
| | 24 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 25 | | public new required Uri DownloadLocation { get; set; } |
| | 26 | |
|
| | 27 | | [JsonPropertyName("software_packageVersion")] |
| | 28 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 29 | | public new required string PackageVersion { get; set; } |
| | 30 | |
|
| | 31 | | [JsonPropertyName("software_primaryPurpose")] |
| | 32 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 33 | | public new required SoftwarePurpose PrimaryPurpose { get; set; } |
| | 34 | |
|
| | 35 | | [JsonPropertyName("ai_autonomyType")] |
| | 36 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 2 | 37 | | public PresenceType? AutonomyType { get; set; } |
| | 38 | |
|
| | 39 | | [JsonPropertyName("ai_domain")] |
| | 40 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 41 | | public IList<string> Domain { get; set; } = new List<string>(); |
| | 42 | |
|
| | 43 | | [JsonPropertyName("ai_energyConsumption")] |
| | 44 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 2 | 45 | | public EnergyConsumption? EnergyConsumption { get; set; } |
| | 46 | |
|
| | 47 | | [JsonPropertyName("ai_hyperparameter")] |
| | 48 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 49 | | public IList<DictionaryEntry> HyperParameter { get; set; } = new List<DictionaryEntry>(); |
| | 50 | |
|
| | 51 | | [JsonPropertyName("ai_informationAboutApplication")] |
| | 52 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 2 | 53 | | public string? InformationAboutApplication { get; set; } |
| | 54 | |
|
| | 55 | | [JsonPropertyName("ai_informationAboutTraining")] |
| | 56 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 2 | 57 | | public string? InformationAboutTraining { get; set; } |
| | 58 | |
|
| | 59 | | [JsonPropertyName("ai_limitation")] |
| | 60 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 2 | 61 | | public string? Limitation { get; set; } |
| | 62 | |
|
| | 63 | | [JsonPropertyName("ai_metric")] |
| | 64 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 65 | | public IList<DictionaryEntry> Metric { get; set; } = new List<DictionaryEntry>(); |
| | 66 | |
|
| | 67 | | [JsonPropertyName("ai_metricDecisionThreshold")] |
| | 68 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 69 | | public IList<DictionaryEntry> MetricDecisionThreshold { get; set; } = new List<DictionaryEntry>(); |
| | 70 | |
|
| | 71 | | [JsonPropertyName("ai_modelDataPreprocessing")] |
| | 72 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 73 | | public IList<string> ModelDataPreprocessing { get; set; } = new List<string>(); |
| | 74 | |
|
| | 75 | | [JsonPropertyName("ai_modelExplainability")] |
| | 76 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 77 | | public IList<string> ModelExplainability { get; set; } = new List<string>(); |
| | 78 | |
|
| | 79 | | [JsonPropertyName("ai_safetyRiskAssessment")] |
| | 80 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 2 | 81 | | public SafetyRiskAssessmentType? SafetyRiskAssessment { get; set; } |
| | 82 | |
|
| | 83 | | [JsonPropertyName("ai_standardCompliance")] |
| | 84 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 85 | | public IList<string> StandardCompliance { get; set; } = new List<string>(); |
| | 86 | |
|
| | 87 | | [JsonPropertyName("ai_typeOfModel")] |
| | 88 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 7 | 89 | | public IList<string> TypeOfModel { get; set; } = new List<string>(); |
| | 90 | |
|
| | 91 | | [JsonPropertyName("ai_useSensitivePersonalInformation")] |
| | 92 | | [JsonConverter(typeof(SpdxModelConverterFactory))] |
| 2 | 93 | | public PresenceType? UseSensitivePersonalInformation { get; set; } |
| | 94 | |
|
| | 95 | | // protected internal no-parm constructor required for deserialization |
| | 96 | | #pragma warning disable CS8618, CS9264 |
| 2 | 97 | | protected internal AiPackage() |
| | 98 | | { |
| 2 | 99 | | } |
| | 100 | | #pragma warning restore CS8618, CS9264 |
| | 101 | |
|
| | 102 | | [SetsRequiredMembers] |
| | 103 | | public AiPackage(Catalog catalog, CreationInfo creationInfo, DateTimeOffset releaseTime, Agent suppliedBy, |
| 1 | 104 | | Uri downloadLocation, string packageVersion, SoftwarePurpose primaryPurpose) : base(catalog, creationInfo) |
| | 105 | | { |
| 1 | 106 | | ReleaseTime = releaseTime; |
| 1 | 107 | | SuppliedBy = suppliedBy; |
| 1 | 108 | | DownloadLocation = downloadLocation; |
| 1 | 109 | | PackageVersion = packageVersion; |
| 1 | 110 | | PrimaryPurpose = primaryPurpose; |
| 1 | 111 | | } |
| | 112 | |
|
| | 113 | | public override void Validate() |
| | 114 | | { |
| 2 | 115 | | base.Validate(); |
| 1 | 116 | | ValidateRequiredProperty(nameof(ReleaseTime)); |
| 1 | 117 | | ValidateRequiredProperty(nameof(SuppliedBy)); |
| 1 | 118 | | ValidateRequiredProperty(nameof(DownloadLocation)); |
| 1 | 119 | | ValidateRequiredProperty(nameof(PackageVersion)); |
| 1 | 120 | | ValidateRequiredProperty(nameof(PrimaryPurpose)); |
| 1 | 121 | | } |
| | 122 | | } |