/*
Edge Application API

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

API version: 2.0.0
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package edgeapplications

import (
	"encoding/json"
	"bytes"
	"fmt"
)

// checks if the RulesEngineCriteria type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RulesEngineCriteria{}

// RulesEngineCriteria struct for RulesEngineCriteria
type RulesEngineCriteria struct {
	Conditional string `json:"conditional"`
	Variable string `json:"variable"`
	Operator string `json:"operator"`
	InputValue *string `json:"input_value,omitempty"`
}

type _RulesEngineCriteria RulesEngineCriteria

// NewRulesEngineCriteria instantiates a new RulesEngineCriteria object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewRulesEngineCriteria(conditional string, variable string, operator string) *RulesEngineCriteria {
	this := RulesEngineCriteria{}
	this.Conditional = conditional
	this.Variable = variable
	this.Operator = operator
	return &this
}

// NewRulesEngineCriteriaWithDefaults instantiates a new RulesEngineCriteria object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewRulesEngineCriteriaWithDefaults() *RulesEngineCriteria {
	this := RulesEngineCriteria{}
	return &this
}

// GetConditional returns the Conditional field value
func (o *RulesEngineCriteria) GetConditional() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Conditional
}

// GetConditionalOk returns a tuple with the Conditional field value
// and a boolean to check if the value has been set.
func (o *RulesEngineCriteria) GetConditionalOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Conditional, true
}

// SetConditional sets field value
func (o *RulesEngineCriteria) SetConditional(v string) {
	o.Conditional = v
}

// GetVariable returns the Variable field value
func (o *RulesEngineCriteria) GetVariable() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Variable
}

// GetVariableOk returns a tuple with the Variable field value
// and a boolean to check if the value has been set.
func (o *RulesEngineCriteria) GetVariableOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Variable, true
}

// SetVariable sets field value
func (o *RulesEngineCriteria) SetVariable(v string) {
	o.Variable = v
}

// GetOperator returns the Operator field value
func (o *RulesEngineCriteria) GetOperator() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Operator
}

// GetOperatorOk returns a tuple with the Operator field value
// and a boolean to check if the value has been set.
func (o *RulesEngineCriteria) GetOperatorOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Operator, true
}

// SetOperator sets field value
func (o *RulesEngineCriteria) SetOperator(v string) {
	o.Operator = v
}

// GetInputValue returns the InputValue field value if set, zero value otherwise.
func (o *RulesEngineCriteria) GetInputValue() string {
	if o == nil || IsNil(o.InputValue) {
		var ret string
		return ret
	}
	return *o.InputValue
}

// GetInputValueOk returns a tuple with the InputValue field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *RulesEngineCriteria) GetInputValueOk() (*string, bool) {
	if o == nil || IsNil(o.InputValue) {
		return nil, false
	}
	return o.InputValue, true
}

// HasInputValue returns a boolean if a field has been set.
func (o *RulesEngineCriteria) HasInputValue() bool {
	if o != nil && !IsNil(o.InputValue) {
		return true
	}

	return false
}

// SetInputValue gets a reference to the given string and assigns it to the InputValue field.
func (o *RulesEngineCriteria) SetInputValue(v string) {
	o.InputValue = &v
}

func (o RulesEngineCriteria) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o RulesEngineCriteria) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["conditional"] = o.Conditional
	toSerialize["variable"] = o.Variable
	toSerialize["operator"] = o.Operator
	if !IsNil(o.InputValue) {
		toSerialize["input_value"] = o.InputValue
	}
	return toSerialize, nil
}

func (o *RulesEngineCriteria) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"conditional",
		"variable",
		"operator",
	}

	allProperties := make(map[string]interface{})

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varRulesEngineCriteria := _RulesEngineCriteria{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varRulesEngineCriteria)

	if err != nil {
		return err
	}

	*o = RulesEngineCriteria(varRulesEngineCriteria)

	return err
}

type NullableRulesEngineCriteria struct {
	value *RulesEngineCriteria
	isSet bool
}

func (v NullableRulesEngineCriteria) Get() *RulesEngineCriteria {
	return v.value
}

func (v *NullableRulesEngineCriteria) Set(val *RulesEngineCriteria) {
	v.value = val
	v.isSet = true
}

func (v NullableRulesEngineCriteria) IsSet() bool {
	return v.isSet
}

func (v *NullableRulesEngineCriteria) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableRulesEngineCriteria(val *RulesEngineCriteria) *NullableRulesEngineCriteria {
	return &NullableRulesEngineCriteria{value: val, isSet: true}
}

func (v NullableRulesEngineCriteria) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableRulesEngineCriteria) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}


