/*
Management API

API version: 3
*/

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

package management

import (
	"encoding/json"

	"github.com/adyen/adyen-go-api-library/v21/src/common"
)

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

// AndroidAppError struct for AndroidAppError
type AndroidAppError struct {
	// The error code of the Android app with the `status` of either **error** or **invalid**.
	ErrorCode *string `json:"errorCode,omitempty"`
	// The list of payment terminal models to which the returned `errorCode` applies.
	TerminalModels []string `json:"terminalModels,omitempty"`
}

// NewAndroidAppError instantiates a new AndroidAppError 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 NewAndroidAppError() *AndroidAppError {
	this := AndroidAppError{}
	return &this
}

// NewAndroidAppErrorWithDefaults instantiates a new AndroidAppError 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 NewAndroidAppErrorWithDefaults() *AndroidAppError {
	this := AndroidAppError{}
	return &this
}

// GetErrorCode returns the ErrorCode field value if set, zero value otherwise.
func (o *AndroidAppError) GetErrorCode() string {
	if o == nil || common.IsNil(o.ErrorCode) {
		var ret string
		return ret
	}
	return *o.ErrorCode
}

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

// HasErrorCode returns a boolean if a field has been set.
func (o *AndroidAppError) HasErrorCode() bool {
	if o != nil && !common.IsNil(o.ErrorCode) {
		return true
	}

	return false
}

// SetErrorCode gets a reference to the given string and assigns it to the ErrorCode field.
func (o *AndroidAppError) SetErrorCode(v string) {
	o.ErrorCode = &v
}

// GetTerminalModels returns the TerminalModels field value if set, zero value otherwise.
func (o *AndroidAppError) GetTerminalModels() []string {
	if o == nil || common.IsNil(o.TerminalModels) {
		var ret []string
		return ret
	}
	return o.TerminalModels
}

// GetTerminalModelsOk returns a tuple with the TerminalModels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AndroidAppError) GetTerminalModelsOk() ([]string, bool) {
	if o == nil || common.IsNil(o.TerminalModels) {
		return nil, false
	}
	return o.TerminalModels, true
}

// HasTerminalModels returns a boolean if a field has been set.
func (o *AndroidAppError) HasTerminalModels() bool {
	if o != nil && !common.IsNil(o.TerminalModels) {
		return true
	}

	return false
}

// SetTerminalModels gets a reference to the given []string and assigns it to the TerminalModels field.
func (o *AndroidAppError) SetTerminalModels(v []string) {
	o.TerminalModels = v
}

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

func (o AndroidAppError) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.ErrorCode) {
		toSerialize["errorCode"] = o.ErrorCode
	}
	if !common.IsNil(o.TerminalModels) {
		toSerialize["terminalModels"] = o.TerminalModels
	}
	return toSerialize, nil
}

type NullableAndroidAppError struct {
	value *AndroidAppError
	isSet bool
}

func (v NullableAndroidAppError) Get() *AndroidAppError {
	return v.value
}

func (v *NullableAndroidAppError) Set(val *AndroidAppError) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAndroidAppError(val *AndroidAppError) *NullableAndroidAppError {
	return &NullableAndroidAppError{value: val, isSet: true}
}

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

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