-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathStructure.cs
67 lines (60 loc) · 2.43 KB
/
Structure.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections;
using C4Sharp.Models.Relationships;
namespace C4Sharp.Models
{
/// <summary>
/// In order to create these maps of your code, we first need a common set of abstractions to create a ubiquitous
/// language that we can use to describe the static structure of a software system. The C4 model considers the
/// static structures of a software system in terms of containers, components and code. And people use the software
/// systems that we build.
/// <see href="https://c4model.com/"/>
/// </summary>
public abstract record Structure
{
public string Alias { get; }
public string Label { get; }
public string Description { get; init; } = string.Empty;
public string[] Tags { get; init; } = Array.Empty<string>();
public string Link { get; init; } = string.Empty;
public Boundary Boundary { get; init; } = Boundary.Internal;
/// <summary>
/// Constructor
/// </summary>
/// <param name="alias">Should be unique</param>
/// <param name="label"></param>
protected Structure(string alias, string label) => (Alias, Label) = (alias, label);
/// <summary>
/// Forward relationship
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static Relationship operator >(Structure a, Structure b) =>
new (a, b, "uses");
/// <summary>
/// Bidirectional relationship
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static Relationship operator >=(Structure a, Structure b) =>
new (a, Direction.Bidirectional, b, "uses");
/// <summary>
/// Bidirectional relationship
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static Relationship operator <=(Structure a, Structure b) =>
new (a, Direction.Bidirectional, b, "uses");
/// <summary>
/// Back relationship
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
public static Relationship operator <(Structure a, Structure b) =>
new (a, Direction.Back, b, "uses");
}
}