using System;

namespace InABox.Core
{
    public class DFLayoutImage : DFLayoutControl
    {
        [EditorSequence(0)]
        public ImageDocumentLink Image => InitializeField(ref _image, nameof(Image));
        private ImageDocumentLink _image;

        protected override string GetDescription()
        {
            return Image != null ? Image.FileName : "";
        }

        protected override void LoadProperties()
        {
            base.LoadProperties();
            Image.ID = GetProperty("Image.ID", Guid.Empty);
            Image.FileName = GetProperty("Image.FileName", "");
        }

        protected override void SaveProperties()
        {
            base.SaveProperties();
            SetProperty("Image.ID", Image.ID);
            SetProperty("Image.FileName", Image.FileName);
        }
    }
}