| | 1 | | using System.Globalization; |
| | 2 | |
|
| | 3 | | namespace Spdx3.Model.Lite; |
| | 4 | |
|
| | 5 | | public class LiteDomainComplianceFinding |
| | 6 | | { |
| | 7 | | public readonly string Description; |
| | 8 | | public readonly LiteDomainComplianceFindingType FindingType; |
| | 9 | | public readonly BaseModelClass Obj; |
| | 10 | | public readonly string? PropertyName; |
| | 11 | |
|
| 32 | 12 | | public LiteDomainComplianceFinding(LiteDomainComplianceFindingType findingType, BaseModelClass obj, |
| 32 | 13 | | string propertyName, string description) |
| | 14 | | { |
| 32 | 15 | | Obj = obj; |
| 32 | 16 | | PropertyName = propertyName; |
| 32 | 17 | | Description = description; |
| 32 | 18 | | FindingType = findingType; |
| 32 | 19 | | } |
| | 20 | |
|
| 1 | 21 | | public LiteDomainComplianceFinding(LiteDomainComplianceFindingType findingType, BaseModelClass obj, |
| 1 | 22 | | string description) |
| | 23 | | { |
| 1 | 24 | | Obj = obj; |
| 1 | 25 | | PropertyName = null; |
| 1 | 26 | | Description = description; |
| 1 | 27 | | FindingType = findingType; |
| 1 | 28 | | } |
| | 29 | |
|
| | 30 | |
|
| | 31 | | public override string ToString() |
| | 32 | | { |
| 2 | 33 | | var objType = Obj.GetType().Name; |
| 2 | 34 | | var objId = Obj.SpdxId.ToString(); |
| 2 | 35 | | var level = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(FindingType.ToString()); |
| 2 | 36 | | var prop = PropertyName is null ? "" : $".{PropertyName}"; |
| 2 | 37 | | return $"{level}: {objType}[{objId}]{prop}: {Description}"; |
| | 38 | | } |
| | 39 | | } |