namespace InABox.Core
{
    
    public class DFLayoutStringFieldProperties : DFLayoutFieldProperties<string>
    {
        [EditorSequence(3)]
        [CheckBoxEditor(Caption = "Allow Wrap?")]
        public bool TextWrapping { get; set; }
        
        [EditorSequence(4)]
        [CheckBoxEditor(Caption = "Popup Editor?")]
        public bool PopupEditor { get; set; }
        
        protected override void Init()
        {
            base.Init();
            PopupEditor = false;
            TextWrapping = false;
        }

        public override object? ParseValue(object? value)
        {
            return value?.ToString();
        }

        public override string FormatValue(object? value)
        {
            return value?.ToString() ?? "";
        }

        protected override void LoadProperties()
        {
            base.LoadProperties();
            PopupEditor = GetProperty(nameof(PopupEditor), false);
            TextWrapping = GetProperty(nameof(TextWrapping), false);
        }

        protected override void SaveProperties()
        {
            base.SaveProperties();
            SetProperty(nameof(PopupEditor), PopupEditor);
            SetProperty(nameof(TextWrapping), TextWrapping);
        }
    }
}