using System;
using InABox.Core;

namespace InABox.Avalonia
{
    public abstract class EntityDocumentShell<TModel,TEntity, TEntityLink, TDocument> : Shell<TModel, TDocument>, IEntityDocumentShell
        where TModel : ICoreRepository
        where TEntity : Entity, IPersistent, IRemotable 
        where TEntityLink : IEntityLink<TEntity>
        where TDocument : Entity, IPersistent, IRemotable, IEntityDocument<TEntityLink>, new()
    {
        protected override void ConfigureColumns(ShellColumns<TModel, TDocument> columns)
        {
            columns
                .Map(nameof(ParentID), x => x.EntityLink.ID)
                .Map(nameof(DocumentID), x => x.DocumentLink.ID)
                .Map(nameof(FileName), x => x.DocumentLink.FileName)
                .Map(nameof(Thumbnail), x => x.Thumbnail);
        }

        public Guid ParentID
        {
            get => Get<Guid>();
            set => Set(value);
        }

        public Guid DocumentID
        {
            get => Get<Guid>();
            set => Set(value);
        }

        public String FileName
        {
            get => Get<String>();
            set => Set(value);
        }

        public byte[] Thumbnail
        {
            get => Get<byte[]>();
            set => Set(value);
        }
 
    }
}