/*
Adyen Recurring API

API version: 68
*/

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

package recurring

import (
	"encoding/json"

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

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

// PermitResult struct for PermitResult
type PermitResult struct {
	// The key to link permit requests to permit results.
	ResultKey *string `json:"resultKey,omitempty"`
	// The permit token which is used to make payments by the partner company.
	Token *string `json:"token,omitempty"`
}

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

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

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

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

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

	return false
}

// SetResultKey gets a reference to the given string and assigns it to the ResultKey field.
func (o *PermitResult) SetResultKey(v string) {
	o.ResultKey = &v
}

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

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

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

	return false
}

// SetToken gets a reference to the given string and assigns it to the Token field.
func (o *PermitResult) SetToken(v string) {
	o.Token = &v
}

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

func (o PermitResult) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.ResultKey) {
		toSerialize["resultKey"] = o.ResultKey
	}
	if !common.IsNil(o.Token) {
		toSerialize["token"] = o.Token
	}
	return toSerialize, nil
}

type NullablePermitResult struct {
	value *PermitResult
	isSet bool
}

func (v NullablePermitResult) Get() *PermitResult {
	return v.value
}

func (v *NullablePermitResult) Set(val *PermitResult) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePermitResult(val *PermitResult) *NullablePermitResult {
	return &NullablePermitResult{value: val, isSet: true}
}

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

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