using InABox.Core;
using InABox.Core.Postable;
using InABox.Poster.Shared;
using InABox.Scripting;
using System.Collections.Generic;
using System.Formats.Asn1;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InABox.Poster.Timberline;

public class TimberlinePosterEngine<TPostable, TSettings> : BasePosterEngine<TPostable, ITimberlinePoster<TPostable, TSettings>, TSettings>
    where TPostable : Entity, IPostable, IRemotable, IPersistent, new()
    where TSettings : TimberlinePosterSettings<TPostable>, new()
{
    protected override ITimberlinePoster<TPostable, TSettings> CreatePoster()
    {
        var poster = base.CreatePoster();
        poster.Script = GetScriptDocument();
        return poster;
    }

    public override bool BeforePost(IDataModel<TPostable> model)
    {
        return Poster.BeforePost(model);
    }

    protected override IPostResult<TPostable> DoProcess(IDataModel<TPostable> model)
    {
        return Poster.Process(model);
    }
    public override void AfterPost(IDataModel<TPostable> model, IPostResult<TPostable> result)
    {
        Poster.AfterPost(model, result);
    }
}
