internal static FileApiModel DeserializeFileApiModel(XElement element)
        {
            long?                      aeatApprovedFileId         = default;
            bool?                      canBeModified              = default;
            DateTimeOffset?            cannotBeModifiedBeforeDate = default;
            string                     code                = default;
            DateTimeOffset?            date                = default;
            long?                      dependencyId        = default;
            string                     dependencyNumber    = default;
            string                     dependencySubType   = default;
            FileApiModelDependencyType?dependencyType      = default;
            string                     description         = default;
            string                     displayFullFilename = default;
            string                     extension           = default;
            string                     filename            = default;
            long?                      id                     = default;
            bool?                      isAeatApproved         = default;
            bool?                      isAeatApprovedOriginal = default;
            long?                      parentId               = default;
            string                     sha256Signature        = default;
            long?                      size                   = default;
            FileApiModelType?          type                   = default;

            if (element.Element("aeatApprovedFileId") is XElement aeatApprovedFileIdElement)
            {
                aeatApprovedFileId = (long?)aeatApprovedFileIdElement;
            }
            if (element.Element("canBeModified") is XElement canBeModifiedElement)
            {
                canBeModified = (bool?)canBeModifiedElement;
            }
            if (element.Element("cannotBeModifiedBeforeDate") is XElement cannotBeModifiedBeforeDateElement)
            {
                cannotBeModifiedBeforeDate = cannotBeModifiedBeforeDateElement.GetDateTimeOffsetValue("O");
            }
            if (element.Element("code") is XElement codeElement)
            {
                code = (string)codeElement;
            }
            if (element.Element("date") is XElement dateElement)
            {
                date = dateElement.GetDateTimeOffsetValue("O");
            }
            if (element.Element("dependencyId") is XElement dependencyIdElement)
            {
                dependencyId = (long?)dependencyIdElement;
            }
            if (element.Element("dependencyNumber") is XElement dependencyNumberElement)
            {
                dependencyNumber = (string)dependencyNumberElement;
            }
            if (element.Element("dependencySubType") is XElement dependencySubTypeElement)
            {
                dependencySubType = (string)dependencySubTypeElement;
            }
            if (element.Element("dependencyType") is XElement dependencyTypeElement)
            {
                dependencyType = new FileApiModelDependencyType(dependencyTypeElement.Value);
            }
            if (element.Element("description") is XElement descriptionElement)
            {
                description = (string)descriptionElement;
            }
            if (element.Element("displayFullFilename") is XElement displayFullFilenameElement)
            {
                displayFullFilename = (string)displayFullFilenameElement;
            }
            if (element.Element("extension") is XElement extensionElement)
            {
                extension = (string)extensionElement;
            }
            if (element.Element("filename") is XElement filenameElement)
            {
                filename = (string)filenameElement;
            }
            if (element.Element("id") is XElement idElement)
            {
                id = (long?)idElement;
            }
            if (element.Element("isAeatApproved") is XElement isAeatApprovedElement)
            {
                isAeatApproved = (bool?)isAeatApprovedElement;
            }
            if (element.Element("isAeatApprovedOriginal") is XElement isAeatApprovedOriginalElement)
            {
                isAeatApprovedOriginal = (bool?)isAeatApprovedOriginalElement;
            }
            if (element.Element("parentId") is XElement parentIdElement)
            {
                parentId = (long?)parentIdElement;
            }
            if (element.Element("sha256Signature") is XElement sha256SignatureElement)
            {
                sha256Signature = (string)sha256SignatureElement;
            }
            if (element.Element("size") is XElement sizeElement)
            {
                size = (long?)sizeElement;
            }
            if (element.Element("type") is XElement typeElement)
            {
                type = new FileApiModelType(typeElement.Value);
            }
            return(new FileApiModel(aeatApprovedFileId, canBeModified, cannotBeModifiedBeforeDate, code, date, dependencyId, dependencyNumber, dependencySubType, dependencyType, description, displayFullFilename, extension, filename, id, isAeatApproved, isAeatApprovedOriginal, parentId, sha256Signature, size, type));
        }
        internal static FileApiModel DeserializeFileApiModel(JsonElement element)
        {
            Optional <long>                       aeatApprovedFileId         = default;
            Optional <bool>                       canBeModified              = default;
            Optional <DateTimeOffset>             cannotBeModifiedBeforeDate = default;
            Optional <string>                     code                = default;
            Optional <DateTimeOffset>             date                = default;
            Optional <long>                       dependencyId        = default;
            Optional <string>                     dependencyNumber    = default;
            Optional <string>                     dependencySubType   = default;
            Optional <FileApiModelDependencyType> dependencyType      = default;
            Optional <string>                     description         = default;
            Optional <string>                     displayFullFilename = default;
            Optional <string>                     extension           = default;
            Optional <string>                     filename            = default;
            Optional <long>                       id                     = default;
            Optional <bool>                       isAeatApproved         = default;
            Optional <bool>                       isAeatApprovedOriginal = default;
            Optional <long>                       parentId               = default;
            Optional <string>                     sha256Signature        = default;
            Optional <long>                       size                   = default;
            Optional <FileApiModelType>           type                   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("aeatApprovedFileId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    aeatApprovedFileId = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("canBeModified"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    canBeModified = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("cannotBeModifiedBeforeDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    cannotBeModifiedBeforeDate = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("code"))
                {
                    code = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("date"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    date = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("dependencyId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    dependencyId = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("dependencyNumber"))
                {
                    dependencyNumber = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dependencySubType"))
                {
                    dependencySubType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dependencyType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    dependencyType = new FileApiModelDependencyType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("displayFullFilename"))
                {
                    displayFullFilename = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("extension"))
                {
                    extension = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("filename"))
                {
                    filename = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("isAeatApproved"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isAeatApproved = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("isAeatApprovedOriginal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isAeatApprovedOriginal = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("parentId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    parentId = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("sha256Signature"))
                {
                    sha256Signature = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("size"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    size = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new FileApiModelType(property.Value.GetString());
                    continue;
                }
            }
            return(new FileApiModel(Optional.ToNullable(aeatApprovedFileId), Optional.ToNullable(canBeModified), Optional.ToNullable(cannotBeModifiedBeforeDate), code.Value, Optional.ToNullable(date), Optional.ToNullable(dependencyId), dependencyNumber.Value, dependencySubType.Value, Optional.ToNullable(dependencyType), description.Value, displayFullFilename.Value, extension.Value, filename.Value, Optional.ToNullable(id), Optional.ToNullable(isAeatApproved), Optional.ToNullable(isAeatApprovedOriginal), Optional.ToNullable(parentId), sha256Signature.Value, Optional.ToNullable(size), Optional.ToNullable(type)));
        }