2using System.Collections.Generic;
4using System.Xml.Serialization;
5using LotSizingDataModel.Core.Common;
24[XmlType(TypeName =
"productStructureDescriptor")]
37 private bool _hasCycle;
38 private int _maximumDepth;
40 private DateTime? _analyzedAtUtc;
42 private string _analyzerVersion =
45 private string _supplyChainFingerprint =
48 private string _analysisComment =
86 [XmlAttribute(
"declaredType")]
96 NotifyDerivedProperties();
105 [XmlAttribute(
"detectedType")]
108 get => _detectedType;
115 NotifyDerivedProperties();
124 [XmlAttribute(
"checkStatus")]
134 NotifyDerivedProperties();
146 [XmlAttribute(
"hasCycle")]
156 NotifyDerivedProperties();
169 [XmlAttribute(
"maximumDepth")]
172 get => _maximumDepth;
177 throw new ArgumentOutOfRangeException(
180 "The maximum depth cannot be negative.");
197 [XmlArray(
"rootItemIds")]
198 [XmlArrayItem(
"itemId")]
209 [XmlArray(
"leafItemIds")]
210 [XmlArrayItem(
"itemId")]
218 [XmlArray(
"sharedComponentItemIds")]
219 [XmlArrayItem(
"itemId")]
231 [XmlElement(
"analyzedAtUtc", IsNullable =
true)]
234 get => _analyzedAtUtc;
239 ? ConvertToUtc(value.Value)
246 NotifyDerivedProperties();
255 [XmlAttribute(
"analyzerVersion")]
258 get => _analyzerVersion;
260 ref _analyzerVersion,
261 value?.Trim() ??
string.Empty);
272 [XmlAttribute(
"supplyChainFingerprint")]
275 get => _supplyChainFingerprint;
277 ref _supplyChainFingerprint,
278 value?.Trim() ??
string.Empty);
285 [XmlElement(
"analysisComment")]
288 get => _analysisComment;
290 ref _analysisComment,
291 value ??
string.Empty);
326 SharedComponentItemIds.Count > 0;
336 .DeclaredAndContradicted;
360 .DeclaredAndContradicted
429 NotifyDerivedProperties();
446 IEnumerable<int> rootItemIds,
447 IEnumerable<int> leafItemIds,
448 IEnumerable<int> sharedComponentItemIds)
450 ArgumentNullException.ThrowIfNull(rootItemIds);
451 ArgumentNullException.ThrowIfNull(leafItemIds);
452 ArgumentNullException.ThrowIfNull(
453 sharedComponentItemIds);
458 nameof(rootItemIds));
463 nameof(leafItemIds));
467 sharedComponentItemIds,
468 nameof(sharedComponentItemIds));
479 NotifyDerivedProperties();
486 $
"Declared: {DeclaredType}; " +
487 $
"detected: {DetectedType}; " +
488 $
"status: {CheckStatus}; " +
489 $
"depth: {MaximumDepth}";
492 private static void ReplaceItemIds(
493 ICollection<int> destination,
494 IEnumerable<int> source,
495 string parameterName)
509 throw new ArgumentException(
510 "Every item identifier must be " +
511 "strictly positive.",
517 foreach (
int itemId
in itemIds)
519 destination.Add(itemId);
523 private static DateTime ConvertToUtc(
526 return value.Kind
switch
531 DateTimeKind.Local =>
532 value.ToUniversalTime(),
535 DateTime.SpecifyKind(
541 private void NotifyDerivedProperties()
ProductStructureCheckStatus
Indicates the current status of the declaration, automatic detection and verification of a product bi...
@ DetectedOnly
A product-structure type has been detected automatically, but no declared type is available for compa...
@ Invalid
The bill-of-materials graph is invalid and cannot be assigned a valid product-structure type.
@ DeclaredAndConfirmed
The declared product-structure type is consistent with the automatically detected type.
@ NotAnalyzed
No product-structure type has been declared and no automatic analysis has been performed.
@ DeclaredOnly
A product-structure type has been declared, but the supply-chain bill of materials has not yet been a...
ProductStructureType
Identifies the structural category of a product bill-of-materials graph.
@ Unknown
The product-structure type is unknown or has not yet been analyzed.