using System.ComponentModel; using System.Text.Json.Serialization; using Microsoft.AspNetCore.Components.Forms; namespace decePubClient.Models; public enum UploadState { Uploading, Processing, Ready, Failed } /// /// A file attached in the composer. It is uploaded as soon as it is picked, streamed from the browser's file (nothing of /// it is kept but a small preview), and its id is kept, so a post that fails never sends it again. /// public class UploadMedia { public string ContentType { get; set; } public string FileName { get; set; } public string AltText { get; set; } public long Size { get; set; } [JsonIgnore, Bindable(false)] public IBrowserFile File { get; set; } /// A small picture of it (a thumbnail the browser made), or for media already posted its server's preview. [JsonIgnore, Bindable(false)] public string Preview { get; set; } [JsonIgnore, Bindable(false)] public UploadState State { get; set; } [JsonIgnore, Bindable(false)] public string Id { get; set; } [JsonIgnore, Bindable(false)] public string Error { get; set; } /// The description the server holds: a different one is sent before the post. [JsonIgnore, Bindable(false)] public string SentAltText { get; set; } /// Already on the post being edited: its description changes through the edit. [JsonIgnore, Bindable(false)] public bool Posted { get; set; } [JsonIgnore, Bindable(false)] public CancellationTokenSource Cancel { get; set; } [JsonIgnore, Bindable(false)] public Task Done { get; set; } = Task.CompletedTask; }