using GenHTTP.Api.Content;

namespace InABox.API
{
    public class RestHandlerBuilder : IHandlerBuilder<RestHandlerBuilder>
    {
        private readonly List<IConcernBuilder> _Concerns = new();

        public RestHandlerBuilder Add(IConcernBuilder concern)
        {
            _Concerns.Add(concern);
            return this;
        }

        public IHandler Build(IHandler parent)
        {
            return Concerns.Chain(parent, _Concerns, p => new RestHandler(p));
        }
    }
}