/*
AutoGlue API

API for managing K3s clusters across cloud providers

API version: 1.0
*/

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

package autoglue

import (
	"encoding/json"
)

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

// DtoTokenPair struct for DtoTokenPair
type DtoTokenPair struct {
	AccessToken  *string `json:"access_token,omitempty"`
	ExpiresIn    *int32  `json:"expires_in,omitempty"`
	RefreshToken *string `json:"refresh_token,omitempty"`
	TokenType    *string `json:"token_type,omitempty"`
}

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

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

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

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

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

	return false
}

// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field.
func (o *DtoTokenPair) SetAccessToken(v string) {
	o.AccessToken = &v
}

// GetExpiresIn returns the ExpiresIn field value if set, zero value otherwise.
func (o *DtoTokenPair) GetExpiresIn() int32 {
	if o == nil || IsNil(o.ExpiresIn) {
		var ret int32
		return ret
	}
	return *o.ExpiresIn
}

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

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

	return false
}

// SetExpiresIn gets a reference to the given int32 and assigns it to the ExpiresIn field.
func (o *DtoTokenPair) SetExpiresIn(v int32) {
	o.ExpiresIn = &v
}

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

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

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

	return false
}

// SetRefreshToken gets a reference to the given string and assigns it to the RefreshToken field.
func (o *DtoTokenPair) SetRefreshToken(v string) {
	o.RefreshToken = &v
}

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

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

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

	return false
}

// SetTokenType gets a reference to the given string and assigns it to the TokenType field.
func (o *DtoTokenPair) SetTokenType(v string) {
	o.TokenType = &v
}

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

func (o DtoTokenPair) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.AccessToken) {
		toSerialize["access_token"] = o.AccessToken
	}
	if !IsNil(o.ExpiresIn) {
		toSerialize["expires_in"] = o.ExpiresIn
	}
	if !IsNil(o.RefreshToken) {
		toSerialize["refresh_token"] = o.RefreshToken
	}
	if !IsNil(o.TokenType) {
		toSerialize["token_type"] = o.TokenType
	}
	return toSerialize, nil
}

type NullableDtoTokenPair struct {
	value *DtoTokenPair
	isSet bool
}

func (v NullableDtoTokenPair) Get() *DtoTokenPair {
	return v.value
}

func (v *NullableDtoTokenPair) Set(val *DtoTokenPair) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDtoTokenPair(val *DtoTokenPair) *NullableDtoTokenPair {
	return &NullableDtoTokenPair{value: val, isSet: true}
}

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

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