using System;
using Tomlyn.Model;

namespace SessionZero.Data;

public class SzDataObjectTemplate : SzTemplate
{
    public string DataType { get; set; }

    public override void ParseAdditionalMetaData(TomlTable table)
    {
        if (!table.ContainsKey("metadata") || table["metadata"] is not TomlTable metadata) return;
        
        if (metadata.TryGetValue("data_type", out var tempTypeVal))
        {
            DataType = tempTypeVal?.ToString() ?? throw new Exception("Template missing type metadata");
        }
    }
}