| | 1 | | namespace Songhay.Models; |
| | 2 | |
|
| | 3 | | /// <summary> |
| | 4 | | /// Defines the conventional Program metadata. |
| | 5 | | /// </summary> |
| | 6 | | public class ProgramMetadata |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Gets or sets the cloud storage set. |
| | 10 | | /// </summary> |
| 0 | 11 | | public Dictionary<string, Dictionary<string, string>> CloudStorageSet { get; set; } = new(); |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// Gets or sets the DBMS set. |
| | 15 | | /// </summary> |
| 0 | 16 | | public Dictionary<string, DbmsMetadata> DbmsSet { get; set; } = new(); |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// Gets or sets the REST API metadata set. |
| | 20 | | /// </summary> |
| 0 | 21 | | public Dictionary<string, RestApiMetadata> RestApiMetadataSet { get; set; } = new(); |
| | 22 | |
|
| | 23 | | /// <summary> |
| | 24 | | /// Represents this instance as a <c>string</c>. |
| | 25 | | /// </summary> |
| | 26 | | public override string ToString() |
| 0 | 27 | | { |
| 0 | 28 | | var sb = new StringBuilder(); |
| | 29 | |
|
| 0 | 30 | | if (CloudStorageSet.Any()) |
| 0 | 31 | | { |
| 0 | 32 | | sb.AppendLine($"{nameof(CloudStorageSet)}:"); |
| 0 | 33 | | foreach (var item in CloudStorageSet) |
| 0 | 34 | | { |
| 0 | 35 | | sb.AppendLine($" {item.Key}:"); |
| 0 | 36 | | if (item.Value.Any()) |
| 0 | 37 | | { |
| 0 | 38 | | foreach (var item2 in item.Value) |
| 0 | 39 | | { |
| 0 | 40 | | var maxLength = 64; |
| 0 | 41 | | if (item2.Value.Length >= maxLength) |
| 0 | 42 | | sb.AppendLine($" {item2.Key}: {item2.Value.Substring(0, maxLength)}... "); |
| | 43 | | else |
| 0 | 44 | | sb.AppendLine($" {item2.Key}: {item2.Value}... "); |
| 0 | 45 | | } |
| 0 | 46 | | } |
| 0 | 47 | | } |
| 0 | 48 | | } |
| | 49 | |
|
| 0 | 50 | | if (DbmsSet.Any()) |
| 0 | 51 | | { |
| 0 | 52 | | sb.AppendLine($"{nameof(DbmsSet)}:"); |
| 0 | 53 | | foreach (var item in DbmsSet) |
| 0 | 54 | | { |
| 0 | 55 | | sb.AppendLine($" {item.Key}:"); |
| 0 | 56 | | sb.AppendLine($" {item.Value}"); |
| 0 | 57 | | } |
| 0 | 58 | | } |
| | 59 | |
|
| 0 | 60 | | if (RestApiMetadataSet.Any()) |
| 0 | 61 | | { |
| 0 | 62 | | sb.AppendLine($"{nameof(RestApiMetadataSet)}:"); |
| 0 | 63 | | foreach (var item in RestApiMetadataSet) |
| 0 | 64 | | { |
| 0 | 65 | | sb.AppendLine($" {item.Key}:"); |
| 0 | 66 | | sb.AppendLine($" {item.Value}"); |
| 0 | 67 | | } |
| 0 | 68 | | } |
| | 69 | |
|
| 0 | 70 | | return sb.Length > 0 ? sb.ToString() : base.ToString() ?? GetType().Name; |
| 0 | 71 | | } |
| | 72 | | } |