diff --git a/SessionZero.SzfLib/Helpers/SzfHelper.cs b/SessionZero.SzfLib/Helpers/SzfHelper.cs
index c4fa7a1..539f539 100644
--- a/SessionZero.SzfLib/Helpers/SzfHelper.cs
+++ b/SessionZero.SzfLib/Helpers/SzfHelper.cs
@@ -6,6 +6,11 @@ namespace SessionZero.SzfLib.Helpers;
public static class SzfHelper
{
+ ///
+ /// Gets the SzfObject type by its type identifier attribute.
+ ///
+ ///
+ ///
public static Type? FindSzfObjectTypeByAttributeType(string szfType)
{
var obj = Assembly
@@ -18,6 +23,12 @@ public static class SzfHelper
return obj.IsAbstract || obj.IsInterface ? null : obj;
}
+ ///
+ /// Does basic validation of a SzfObject.
+ ///
+ ///
+ ///
+ ///
public static SzfError BasicSzfValidation(ISzfObject obj, bool canHaveEmptyFieldValues = false)
{
SzfError result = new SzfError();
@@ -36,6 +47,12 @@ public static class SzfHelper
return result;
}
+
+ ///
+ /// Gets all sections and subsections of a SzfObject.
+ ///
+ ///
+ ///
public static IEnumerable GetAllSectionsAndSubsections(ISzfObject obj)
{
List allSections = new List();
@@ -49,6 +66,11 @@ public static class SzfHelper
return allSections;
}
+ ///
+ /// Gets all subsections of a given section recursively.
+ ///
+ ///
+ ///
public static IEnumerable GetAllSubsections(SzfSection section)
{
List subsections = new List();
@@ -62,6 +84,11 @@ public static class SzfHelper
return subsections;
}
+ ///
+ /// Gets all fields from all sections and subsections of an SzfObject.
+ ///
+ ///
+ ///
public static IEnumerable GetAllFields(ISzfObject obj)
{
List allFields = new List();
diff --git a/SessionZero.SzfLib/Objects/ISzfCharacter.cs b/SessionZero.SzfLib/Objects/ISzfCharacter.cs
index 4be53fe..6b65772 100644
--- a/SessionZero.SzfLib/Objects/ISzfCharacter.cs
+++ b/SessionZero.SzfLib/Objects/ISzfCharacter.cs
@@ -2,5 +2,6 @@ namespace SessionZero.SzfLib.Objects;
public interface ISzfCharacter
{
-
+ public string Name { get; set; }
+ public ISzfCharacterTemplate TryResolveCharacterTemplate(string lookup);
}
\ No newline at end of file
diff --git a/SessionZero.SzfLib/Objects/SzfCharacter.cs b/SessionZero.SzfLib/Objects/SzfCharacter.cs
index d1603b0..4db09b9 100644
--- a/SessionZero.SzfLib/Objects/SzfCharacter.cs
+++ b/SessionZero.SzfLib/Objects/SzfCharacter.cs
@@ -6,7 +6,29 @@ namespace SessionZero.SzfLib.Objects;
public class SzfCharacter : SzfObject, ISzfCharacter
{
public override string SzfType { get; set; } = "character";
+ public string Name { get; set; }
+
+ public ISzfCharacterTemplate? Template { get; set; }
+
+ public SzfCharacter()
+ {
+ Name = GetMetadataField("Name");
+ }
+
public override SzfError Validate()
+ {
+ var result = new SzfError();
+
+ if (Template is null)
+ {
+ result.AddError($"Template is missing from character with name '{Name}'");
+ }
+
+ return result;
+ }
+
+
+ public ISzfCharacterTemplate TryResolveCharacterTemplate(string lookup)
{
throw new NotImplementedException();
}
diff --git a/SessionZero.SzfLib/Objects/SzfCharacterTemplate.cs b/SessionZero.SzfLib/Objects/SzfCharacterTemplate.cs
index 18407eb..6dd5978 100644
--- a/SessionZero.SzfLib/Objects/SzfCharacterTemplate.cs
+++ b/SessionZero.SzfLib/Objects/SzfCharacterTemplate.cs
@@ -8,6 +8,10 @@ public class SzfCharacterTemplate : SzfObject, ISzfCharacterTemplate
public override string SzfType { get; set; } = "character_template";
public override SzfError Validate()
{
- throw new NotImplementedException();
+ var result = new SzfError();
+
+ var basicValidation = SzfHelper.BasicSzfValidation(this, true);
+
+ return result;
}
}
\ No newline at end of file