internal CacheExpirationActionParameters(CacheExpirationActionParametersTypeName typeName, CacheBehavior cacheBehavior, CacheType cacheType, TimeSpan?cacheDuration)
 {
     TypeName      = typeName;
     CacheBehavior = cacheBehavior;
     CacheType     = cacheType;
     CacheDuration = cacheDuration;
 }
        internal static CacheExpirationActionParameters DeserializeCacheExpirationActionParameters(JsonElement element)
        {
            CacheExpirationActionParametersTypeName typeName = default;
            CacheBehavior        cacheBehavior = default;
            CacheType            cacheType     = default;
            Optional <TimeSpan?> cacheDuration = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new CacheExpirationActionParametersTypeName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("cacheBehavior"))
                {
                    cacheBehavior = new CacheBehavior(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("cacheType"))
                {
                    cacheType = new CacheType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("cacheDuration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        cacheDuration = null;
                        continue;
                    }
                    cacheDuration = property.Value.GetTimeSpan("c");
                    continue;
                }
            }
            return(new CacheExpirationActionParameters(typeName, cacheBehavior, cacheType, Optional.ToNullable(cacheDuration)));
        }
 public CacheExpirationActionParameters(CacheExpirationActionParametersTypeName typeName, CacheBehavior cacheBehavior, CacheType cacheType)
 {
     TypeName      = typeName;
     CacheBehavior = cacheBehavior;
     CacheType     = cacheType;
 }