/*
* InfluxDB OSS API Service
*
* The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint.
*
* OpenAPI spec version: 2.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using OpenAPIDateConverter = InfluxDB.Client.Api.Client.OpenAPIDateConverter;
namespace InfluxDB.Client.Api.Domain
{
///
/// Field
///
[DataContract]
public partial class Field : IEquatable
{
///
/// `type` describes the field type. `func` is a function. `field` is a field reference.
///
/// `type` describes the field type. `func` is a function. `field` is a field reference.
[JsonConverter(typeof(StringEnumConverter))]
public enum TypeEnum
{
///
/// Enum Func for value: func
///
[EnumMember(Value = "func")] Func = 1,
///
/// Enum Field for value: field
///
[EnumMember(Value = "field")] Field = 2,
///
/// Enum Integer for value: integer
///
[EnumMember(Value = "integer")] Integer = 3,
///
/// Enum Number for value: number
///
[EnumMember(Value = "number")] Number = 4,
///
/// Enum Regex for value: regex
///
[EnumMember(Value = "regex")] Regex = 5,
///
/// Enum Wildcard for value: wildcard
///
[EnumMember(Value = "wildcard")] Wildcard = 6
}
///
/// `type` describes the field type. `func` is a function. `field` is a field reference.
///
/// `type` describes the field type. `func` is a function. `field` is a field reference.
[DataMember(Name = "type", EmitDefaultValue = false)]
public TypeEnum? Type { get; set; }
///
/// Initializes a new instance of the class.
///
/// value is the value of the field. Meaning of the value is implied by the `type` key.
/// `type` describes the field type. `func` is a function. `field` is a field reference..
/// Alias overrides the field name in the returned response. Applies only if type is `func`.
/// Args are the arguments to the function.
public Field(string value = default, TypeEnum? type = default, string alias = default,
List args = default)
{
Value = value;
Type = type;
Alias = alias;
Args = args;
}
///
/// value is the value of the field. Meaning of the value is implied by the `type` key
///
/// value is the value of the field. Meaning of the value is implied by the `type` key
[DataMember(Name = "value", EmitDefaultValue = false)]
public string Value { get; set; }
///
/// Alias overrides the field name in the returned response. Applies only if type is `func`
///
/// Alias overrides the field name in the returned response. Applies only if type is `func`
[DataMember(Name = "alias", EmitDefaultValue = false)]
public string Alias { get; set; }
///
/// Args are the arguments to the function
///
/// Args are the arguments to the function
[DataMember(Name = "args", EmitDefaultValue = false)]
public List Args { get; set; }
///
/// Returns the string presentation of the object
///
/// String presentation of the object
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class Field {\n");
sb.Append(" Value: ").Append(Value).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" Alias: ").Append(Alias).Append("\n");
sb.Append(" Args: ").Append(Args).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
///
/// Returns the JSON string presentation of the object
///
/// JSON string presentation of the object
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
///
/// Returns true if objects are equal
///
/// Object to be compared
/// Boolean
public override bool Equals(object input)
{
return Equals(input as Field);
}
///
/// Returns true if Field instances are equal
///
/// Instance of Field to be compared
/// Boolean
public bool Equals(Field input)
{
if (input == null)
{
return false;
}
return
(
Value == input.Value ||
Value != null && Value.Equals(input.Value)
) &&
(
Type == input.Type ||
Type.Equals(input.Type)
) &&
(
Alias == input.Alias ||
Alias != null && Alias.Equals(input.Alias)
) &&
(
Args == input.Args ||
Args != null &&
Args.SequenceEqual(input.Args)
);
}
///
/// Gets the hash code
///
/// Hash code
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hashCode = 41;
if (Value != null)
{
hashCode = hashCode * 59 + Value.GetHashCode();
}
hashCode = hashCode * 59 + Type.GetHashCode();
if (Alias != null)
{
hashCode = hashCode * 59 + Alias.GetHashCode();
}
if (Args != null)
{
hashCode = hashCode * 59 + Args.GetHashCode();
}
return hashCode;
}
}
}
}