internal static ApiAccessApiModel DeserializeApiAccessApiModel(XElement element)
        {
            ApiClientApiModel apiClient    = default;
            bool?          canDisable      = default;
            DateTimeOffset?firstAccessTime = default;
            bool?          isActive        = default;
            DateTimeOffset?lastAccessTime  = default;

            if (element.Element("apiClient") is XElement apiClientElement)
            {
                apiClient = ApiClientApiModel.DeserializeApiClientApiModel(apiClientElement);
            }
            if (element.Element("canDisable") is XElement canDisableElement)
            {
                canDisable = (bool?)canDisableElement;
            }
            if (element.Element("firstAccessTime") is XElement firstAccessTimeElement)
            {
                firstAccessTime = firstAccessTimeElement.GetDateTimeOffsetValue("O");
            }
            if (element.Element("isActive") is XElement isActiveElement)
            {
                isActive = (bool?)isActiveElement;
            }
            if (element.Element("lastAccessTime") is XElement lastAccessTimeElement)
            {
                lastAccessTime = lastAccessTimeElement.GetDateTimeOffsetValue("O");
            }
            return(new ApiAccessApiModel(apiClient, canDisable, firstAccessTime, isActive, lastAccessTime));
        }
 internal ApiAccessApiModel(ApiClientApiModel apiClient, bool?canDisable, DateTimeOffset?firstAccessTime, bool?isActive, DateTimeOffset?lastAccessTime)
 {
     ApiClient       = apiClient;
     CanDisable      = canDisable;
     FirstAccessTime = firstAccessTime;
     IsActive        = isActive;
     LastAccessTime  = lastAccessTime;
 }
        internal static ApiListResultApiClientApiModel DeserializeApiListResultApiClientApiModel(JsonElement element)
        {
            Optional <long> count = default;
            Optional <IReadOnlyList <ApiClientApiModel> > data = default;
            Optional <long> totalCount = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("count"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    count = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("data"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ApiClientApiModel> array = new List <ApiClientApiModel>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ApiClientApiModel.DeserializeApiClientApiModel(item));
                    }
                    data = array;
                    continue;
                }
                if (property.NameEquals("totalCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    totalCount = property.Value.GetInt64();
                    continue;
                }
            }
            return(new ApiListResultApiClientApiModel(Optional.ToNullable(count), Optional.ToList(data), Optional.ToNullable(totalCount)));
        }
        internal static ApiListResultApiClientApiModel DeserializeApiListResultApiClientApiModel(XElement element)
        {
            long?count      = default;
            long?totalCount = default;
            IReadOnlyList <ApiClientApiModel> data = default;

            if (element.Element("count") is XElement countElement)
            {
                count = (long?)countElement;
            }
            if (element.Element("totalCount") is XElement totalCountElement)
            {
                totalCount = (long?)totalCountElement;
            }
            var array = new List <ApiClientApiModel>();

            foreach (var e in element.Elements("ApiClientApiModel"))
            {
                array.Add(ApiClientApiModel.DeserializeApiClientApiModel(e));
            }
            data = array;
            return(new ApiListResultApiClientApiModel(count, data, totalCount));
        }
        internal static ApiAccessApiModel DeserializeApiAccessApiModel(JsonElement element)
        {
            Optional <ApiClientApiModel> apiClient    = default;
            Optional <bool>           canDisable      = default;
            Optional <DateTimeOffset> firstAccessTime = default;
            Optional <bool>           isActive        = default;
            Optional <DateTimeOffset> lastAccessTime  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("apiClient"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    apiClient = ApiClientApiModel.DeserializeApiClientApiModel(property.Value);
                    continue;
                }
                if (property.NameEquals("canDisable"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    canDisable = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("firstAccessTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    firstAccessTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("isActive"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isActive = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("lastAccessTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    lastAccessTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
            }
            return(new ApiAccessApiModel(apiClient.Value, Optional.ToNullable(canDisable), Optional.ToNullable(firstAccessTime), Optional.ToNullable(isActive), Optional.ToNullable(lastAccessTime)));
        }