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

// HandlersMemberUpsertReq struct for HandlersMemberUpsertReq
type HandlersMemberUpsertReq struct {
	Role   *string `json:"role,omitempty"`
	UserId *string `json:"user_id,omitempty"`
}

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

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

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

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

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

	return false
}

// SetRole gets a reference to the given string and assigns it to the Role field.
func (o *HandlersMemberUpsertReq) SetRole(v string) {
	o.Role = &v
}

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

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

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

	return false
}

// SetUserId gets a reference to the given string and assigns it to the UserId field.
func (o *HandlersMemberUpsertReq) SetUserId(v string) {
	o.UserId = &v
}

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

func (o HandlersMemberUpsertReq) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Role) {
		toSerialize["role"] = o.Role
	}
	if !IsNil(o.UserId) {
		toSerialize["user_id"] = o.UserId
	}
	return toSerialize, nil
}

type NullableHandlersMemberUpsertReq struct {
	value *HandlersMemberUpsertReq
	isSet bool
}

func (v NullableHandlersMemberUpsertReq) Get() *HandlersMemberUpsertReq {
	return v.value
}

func (v *NullableHandlersMemberUpsertReq) Set(val *HandlersMemberUpsertReq) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableHandlersMemberUpsertReq(val *HandlersMemberUpsertReq) *NullableHandlersMemberUpsertReq {
	return &NullableHandlersMemberUpsertReq{value: val, isSet: true}
}

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

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