// Copyright (c) Cloud Native Foundation.
// Licensed under the Apache 2.0 license.
// See LICENSE file in the project root for full license information.
namespace CloudNative.CloudEvents
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Net.Mime;
///
/// The CloudEvents attributes
///
public class CloudEventAttributes : IDictionary
{
readonly CloudEventsSpecVersion specVersion;
IDictionary dict = new Dictionary(StringComparer.InvariantCultureIgnoreCase);
IEnumerable extensions;
internal CloudEventAttributes(CloudEventsSpecVersion specVersion, IEnumerable extensions)
{
this.extensions = extensions;
this.specVersion = specVersion;
dict[SpecVersionAttributeName(specVersion)] =
specVersion == CloudEventsSpecVersion.V0_1 ? "0.1" :
specVersion == CloudEventsSpecVersion.V0_2 ? "0.2" : "0.3";
}
int ICollection>.Count => dict.Count;
bool ICollection>.IsReadOnly => dict.IsReadOnly;
ICollection IDictionary.Keys => dict.Keys;
ICollection