/*
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 HandlersCreateUserKeyRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &HandlersCreateUserKeyRequest{}

// HandlersCreateUserKeyRequest struct for HandlersCreateUserKeyRequest
type HandlersCreateUserKeyRequest struct {
	// optional TTL
	ExpiresInHours *int32  `json:"expires_in_hours,omitempty"`
	Name           *string `json:"name,omitempty"`
}

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

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

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

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

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

	return false
}

// SetExpiresInHours gets a reference to the given int32 and assigns it to the ExpiresInHours field.
func (o *HandlersCreateUserKeyRequest) SetExpiresInHours(v int32) {
	o.ExpiresInHours = &v
}

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

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

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

	return false
}

// SetName gets a reference to the given string and assigns it to the Name field.
func (o *HandlersCreateUserKeyRequest) SetName(v string) {
	o.Name = &v
}

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

func (o HandlersCreateUserKeyRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.ExpiresInHours) {
		toSerialize["expires_in_hours"] = o.ExpiresInHours
	}
	if !IsNil(o.Name) {
		toSerialize["name"] = o.Name
	}
	return toSerialize, nil
}

type NullableHandlersCreateUserKeyRequest struct {
	value *HandlersCreateUserKeyRequest
	isSet bool
}

func (v NullableHandlersCreateUserKeyRequest) Get() *HandlersCreateUserKeyRequest {
	return v.value
}

func (v *NullableHandlersCreateUserKeyRequest) Set(val *HandlersCreateUserKeyRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableHandlersCreateUserKeyRequest(val *HandlersCreateUserKeyRequest) *NullableHandlersCreateUserKeyRequest {
	return &NullableHandlersCreateUserKeyRequest{value: val, isSet: true}
}

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

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