// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package telemetry

// Attr is a key-value pair.
type Attr struct {
	Key   string `json:"key,omitempty"`
	Value Value  `json:"value,omitempty"`
}

// String returns an Attr for a string value.
func (,  string) Attr {
	return Attr{, StringValue()}
}

// Int64 returns an Attr for an int64 value.
func ( string,  int64) Attr {
	return Attr{, Int64Value()}
}

// Int returns an Attr for an int value.
func ( string,  int) Attr {
	return Int64(, int64())
}

// Float64 returns an Attr for a float64 value.
func ( string,  float64) Attr {
	return Attr{, Float64Value()}
}

// Bool returns an Attr for a bool value.
func ( string,  bool) Attr {
	return Attr{, BoolValue()}
}

// Bytes returns an Attr for a []byte value.
// The passed slice must not be changed after it is passed.
func ( string,  []byte) Attr {
	return Attr{, BytesValue()}
}

// Slice returns an Attr for a []Value value.
// The passed slice must not be changed after it is passed.
func ( string,  ...Value) Attr {
	return Attr{, SliceValue(...)}
}

// Map returns an Attr for a map value.
// The passed slice must not be changed after it is passed.
func ( string,  ...Attr) Attr {
	return Attr{, MapValue(...)}
}

// Equal returns if a is equal to b.
func ( Attr) ( Attr) bool {
	return .Key == .Key && .Value.Equal(.Value)
}