using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

using decePubClient.Models.Types;
using decePubClient.Resources;

namespace decePubClient.Models;

public class MessageForm
{
	public string RootMessageId { get; set; }

	[Required(ErrorMessageResourceName = ValidationNames.Required, ErrorMessageResourceType = typeof(ErrorMessages))]
	public MessageType MessageType { get; set; } = MessageType.Public;
	[Required(ErrorMessageResourceName = ValidationNames.Required, ErrorMessageResourceType = typeof(ErrorMessages))]
	public ContentType ContentType { get; set; } = ContentType.PlainText;
	[StringLength(64, ErrorMessageResourceName = ValidationNames.MaxLength, ErrorMessageResourceType = typeof(ErrorMessages))]
	public string Title { get; set; }
	[StringLength(5_000, ErrorMessageResourceName = ValidationNames.MaxLength, ErrorMessageResourceType = typeof(ErrorMessages))]
	public string Content { get; set; }
	public List<UploadMedia> Media { get; set; } = new();

	[JsonIgnore, Bindable(false)]
	public MediaType MediaType { get; set; } = MediaType.Images;
	[JsonIgnore, Bindable(false)]
	public bool IsScopeOptionsOpen { get; set; } = false;
}