using Bright.Serialization;
{{
    name = x.name
    namespace = x.namespace
    tables = x.tables
}}
{{cs_start_name_space_grace x.namespace}} 
public partial class {{name}}
{
    {{~for table in tables ~}}
{{~if table.comment != '' ~}}
    /// 
    /// {{table.escape_comment}}
    /// 
{{~end~}}
    public {{table.full_name}} {{table.name}} {get; }
    {{~end~}}
    public {{name}}(System.Func loader)
    {
        var tables = new System.Collections.Generic.Dictionary();
        {{~for table in tables ~}}
        {{table.name}} = new {{table.full_name}}(loader("{{table.output_data_file}}")); 
        tables.Add("{{table.full_name}}", {{table.name}});
        {{~end~}}
        PostInit();
        {{~for table in tables ~}}
        {{table.name}}.Resolve(tables); 
        {{~end~}}
        PostResolve();
    }
    public void TranslateText(System.Func translator)
    {
        {{~for table in tables ~}}
        {{table.name}}.TranslateText(translator); 
        {{~end~}}
    }
    
    partial void PostInit();
    partial void PostResolve();
}
{{cs_end_name_space_grace x.namespace}}