/*
Mender API

Combined API specification for the features of the different Mender backend services, suitable for code generation applications 

API version: 1
Contact: support@mender.io
*/

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

package client

import (
	"encoding/json"
)

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

// LoginOptions Log in options
type LoginOptions struct {
	// Generate a JWT token with no expiration date.
	NoExpiry *bool `json:"no_expiry,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _LoginOptions LoginOptions

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

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

// GetNoExpiry returns the NoExpiry field value if set, zero value otherwise.
func (o *LoginOptions) GetNoExpiry() bool {
	if o == nil || IsNil(o.NoExpiry) {
		var ret bool
		return ret
	}
	return *o.NoExpiry
}

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

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

	return false
}

// SetNoExpiry gets a reference to the given bool and assigns it to the NoExpiry field.
func (o *LoginOptions) SetNoExpiry(v bool) {
	o.NoExpiry = &v
}

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

func (o LoginOptions) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.NoExpiry) {
		toSerialize["no_expiry"] = o.NoExpiry
	}

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *LoginOptions) UnmarshalJSON(data []byte) (err error) {
	varLoginOptions := _LoginOptions{}

	err = json.Unmarshal(data, &varLoginOptions)

	if err != nil {
		return err
	}

	*o = LoginOptions(varLoginOptions)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "no_expiry")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableLoginOptions struct {
	value *LoginOptions
	isSet bool
}

func (v NullableLoginOptions) Get() *LoginOptions {
	return v.value
}

func (v *NullableLoginOptions) Set(val *LoginOptions) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableLoginOptions(val *LoginOptions) *NullableLoginOptions {
	return &NullableLoginOptions{value: val, isSet: true}
}

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

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


