internal CacheExpirationActionDefinition(CacheExpirationActionType typeDefinition, CacheBehaviorSettings cacheBehavior, CacheLevel cacheType, TimeSpan?cacheDuration)
 {
     TypeDefinition = typeDefinition;
     CacheBehavior  = cacheBehavior;
     CacheType      = cacheType;
     CacheDuration  = cacheDuration;
 }
        internal static CacheExpirationActionDefinition DeserializeCacheExpirationActionDefinition(JsonElement element)
        {
            CacheExpirationActionType typeName      = default;
            CacheBehaviorSettings     cacheBehavior = default;
            CacheLevel           cacheType          = default;
            Optional <TimeSpan?> cacheDuration      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new CacheExpirationActionType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("cacheBehavior"))
                {
                    cacheBehavior = new CacheBehaviorSettings(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("cacheType"))
                {
                    cacheType = new CacheLevel(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 CacheExpirationActionDefinition(typeName, cacheBehavior, cacheType, Optional.ToNullable(cacheDuration)));
        }
 public CacheExpirationActionDefinition(CacheExpirationActionType typeDefinition, CacheBehaviorSettings cacheBehavior, CacheLevel cacheType)
 {
     TypeDefinition = typeDefinition;
     CacheBehavior  = cacheBehavior;
     CacheType      = cacheType;
 }