using System;
using System.Collections.Generic;

namespace InABox.Core
{
    // need to add a property to signaturefield (manager signature or something) that prevents a form being saved for later if the 
    // manager signature is present - ensures that form is completed and submitted / cannot be changed
    public class DFLayoutSignaturePadProperties : DFLayoutFieldProperties<byte[], byte[]?>
    {
        [EditorSequence(-995)]
        [NullEditor]
        public override byte[] Default { get; set; } = new byte[] { };
        
        public override string FormatValue(byte[]? value)
        {
            return value != null ? "Yes" : "";
        }

        public override byte[] GetValue(byte[]? value)
        {
            return value ?? Array.Empty<byte>();
        }

        public override byte[]? DeserializeValue(DFLoadStorageEntry entry)
        {
            return entry.GetValue<byte[]>();
        }

        public override void SerializeValue(DFSaveStorageEntry entry, byte[]? value)
        {
            entry.SetValue(value);
        }
    }
}