internal DocumentStatusDetail(Uri url, DateTimeOffset createdOn, DateTimeOffset lastModified, TranslationStatus status, string translateTo, DocumentTranslationError error, float translationProgress, string id, long?characterCharged)
 {
     Url                 = url;
     CreatedOn           = createdOn;
     LastModified        = lastModified;
     Status              = status;
     TranslateTo         = translateTo;
     Error               = error;
     TranslationProgress = translationProgress;
     Id = id;
     CharacterCharged = characterCharged;
 }
        internal DocumentStatusDetail(Uri url, DateTimeOffset createdOn, DateTimeOffset lastModified, TranslationStatus status, string translateTo, float translationProgress, string id)
        {
            if (url == null)
            {
                throw new ArgumentNullException(nameof(url));
            }
            if (translateTo == null)
            {
                throw new ArgumentNullException(nameof(translateTo));
            }
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            Url                 = url;
            CreatedOn           = createdOn;
            LastModified        = lastModified;
            Status              = status;
            TranslateTo         = translateTo;
            TranslationProgress = translationProgress;
            Id = id;
        }
 internal TranslationStatusDetail(string id, DateTimeOffset createdOn, DateTimeOffset lastModified, TranslationStatus status, DocumentTranslationError error, StatusSummary summary)
 {
     Id           = id;
     CreatedOn    = createdOn;
     LastModified = lastModified;
     Status       = status;
     Error        = error;
     Summary      = summary;
 }
        internal static DocumentStatusDetail DeserializeDocumentStatusDetail(JsonElement element)
        {
            Uri               path = default;
            DateTimeOffset    createdDateTimeUtc    = default;
            DateTimeOffset    lastActionDateTimeUtc = default;
            TranslationStatus status = default;
            string            to     = default;
            Optional <DocumentTranslationError> error = default;
            float           progress         = default;
            string          id               = default;
            Optional <long> characterCharged = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("path"))
                {
                    path = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("createdDateTimeUtc"))
                {
                    createdDateTimeUtc = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastActionDateTimeUtc"))
                {
                    lastActionDateTimeUtc = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = new TranslationStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("to"))
                {
                    to = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("error"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    error = DocumentTranslationError.DeserializeDocumentTranslationError(property.Value);
                    continue;
                }
                if (property.NameEquals("progress"))
                {
                    progress = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("characterCharged"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    characterCharged = property.Value.GetInt64();
                    continue;
                }
            }
            return(new DocumentStatusDetail(path, createdDateTimeUtc, lastActionDateTimeUtc, status, to, error.Value, progress, id, Optional.ToNullable(characterCharged)));
        }
        internal TranslationStatusDetail(string id, DateTimeOffset createdOn, DateTimeOffset lastModified, TranslationStatus status, StatusSummary summary)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            if (summary == null)
            {
                throw new ArgumentNullException(nameof(summary));
            }

            Id           = id;
            CreatedOn    = createdOn;
            LastModified = lastModified;
            Status       = status;
            Summary      = summary;
        }