/*
Adyen Checkout API

API version: 71
*/

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

package checkout

import (
	"encoding/json"

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

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

// AndroidPayDetails struct for AndroidPayDetails
type AndroidPayDetails struct {
	// The checkout attempt identifier.
	CheckoutAttemptId *string `json:"checkoutAttemptId,omitempty"`
	// **androidpay**
	Type *string `json:"type,omitempty"`
}

// NewAndroidPayDetails instantiates a new AndroidPayDetails 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 NewAndroidPayDetails() *AndroidPayDetails {
	this := AndroidPayDetails{}
	var type_ string = "androidpay"
	this.Type = &type_
	return &this
}

// NewAndroidPayDetailsWithDefaults instantiates a new AndroidPayDetails 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 NewAndroidPayDetailsWithDefaults() *AndroidPayDetails {
	this := AndroidPayDetails{}
	var type_ string = "androidpay"
	this.Type = &type_
	return &this
}

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

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

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

	return false
}

// SetCheckoutAttemptId gets a reference to the given string and assigns it to the CheckoutAttemptId field.
func (o *AndroidPayDetails) SetCheckoutAttemptId(v string) {
	o.CheckoutAttemptId = &v
}

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

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

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

	return false
}

// SetType gets a reference to the given string and assigns it to the Type field.
func (o *AndroidPayDetails) SetType(v string) {
	o.Type = &v
}

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

func (o AndroidPayDetails) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.CheckoutAttemptId) {
		toSerialize["checkoutAttemptId"] = o.CheckoutAttemptId
	}
	if !common.IsNil(o.Type) {
		toSerialize["type"] = o.Type
	}
	return toSerialize, nil
}

type NullableAndroidPayDetails struct {
	value *AndroidPayDetails
	isSet bool
}

func (v NullableAndroidPayDetails) Get() *AndroidPayDetails {
	return v.value
}

func (v *NullableAndroidPayDetails) Set(val *AndroidPayDetails) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAndroidPayDetails(val *AndroidPayDetails) *NullableAndroidPayDetails {
	return &NullableAndroidPayDetails{value: val, isSet: true}
}

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

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

func (o *AndroidPayDetails) isValidType() bool {
	var allowedEnumValues = []string{"androidpay"}
	for _, allowed := range allowedEnumValues {
		if o.GetType() == allowed {
			return true
		}
	}
	return false
}
