/*
authentik

Making authentication simple.

API version: 2026.5.0-rc1
Contact: hello@goauthentik.io
*/

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

package api

import (
	"encoding/json"
)

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

// AuthenticatorEmailChallengeResponseRequest Authenticator Email Challenge response, device is set by get_response_instance
type AuthenticatorEmailChallengeResponseRequest struct {
	Component            *string `json:"component,omitempty"`
	Code                 *string `json:"code,omitempty"`
	Email                *string `json:"email,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _AuthenticatorEmailChallengeResponseRequest AuthenticatorEmailChallengeResponseRequest

// NewAuthenticatorEmailChallengeResponseRequest instantiates a new AuthenticatorEmailChallengeResponseRequest 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 NewAuthenticatorEmailChallengeResponseRequest() *AuthenticatorEmailChallengeResponseRequest {
	this := AuthenticatorEmailChallengeResponseRequest{}
	var component string = "ak-stage-authenticator-email"
	this.Component = &component
	return &this
}

// NewAuthenticatorEmailChallengeResponseRequestWithDefaults instantiates a new AuthenticatorEmailChallengeResponseRequest 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 NewAuthenticatorEmailChallengeResponseRequestWithDefaults() *AuthenticatorEmailChallengeResponseRequest {
	this := AuthenticatorEmailChallengeResponseRequest{}
	var component string = "ak-stage-authenticator-email"
	this.Component = &component
	return &this
}

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

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

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

	return false
}

// SetComponent gets a reference to the given string and assigns it to the Component field.
func (o *AuthenticatorEmailChallengeResponseRequest) SetComponent(v string) {
	o.Component = &v
}

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

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

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

	return false
}

// SetCode gets a reference to the given string and assigns it to the Code field.
func (o *AuthenticatorEmailChallengeResponseRequest) SetCode(v string) {
	o.Code = &v
}

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

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

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

	return false
}

// SetEmail gets a reference to the given string and assigns it to the Email field.
func (o *AuthenticatorEmailChallengeResponseRequest) SetEmail(v string) {
	o.Email = &v
}

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

func (o AuthenticatorEmailChallengeResponseRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Component) {
		toSerialize["component"] = o.Component
	}
	if !IsNil(o.Code) {
		toSerialize["code"] = o.Code
	}
	if !IsNil(o.Email) {
		toSerialize["email"] = o.Email
	}

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

	return toSerialize, nil
}

func (o *AuthenticatorEmailChallengeResponseRequest) UnmarshalJSON(data []byte) (err error) {
	varAuthenticatorEmailChallengeResponseRequest := _AuthenticatorEmailChallengeResponseRequest{}

	err = json.Unmarshal(data, &varAuthenticatorEmailChallengeResponseRequest)

	if err != nil {
		return err
	}

	*o = AuthenticatorEmailChallengeResponseRequest(varAuthenticatorEmailChallengeResponseRequest)

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

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

	return err
}

type NullableAuthenticatorEmailChallengeResponseRequest struct {
	value *AuthenticatorEmailChallengeResponseRequest
	isSet bool
}

func (v NullableAuthenticatorEmailChallengeResponseRequest) Get() *AuthenticatorEmailChallengeResponseRequest {
	return v.value
}

func (v *NullableAuthenticatorEmailChallengeResponseRequest) Set(val *AuthenticatorEmailChallengeResponseRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAuthenticatorEmailChallengeResponseRequest(val *AuthenticatorEmailChallengeResponseRequest) *NullableAuthenticatorEmailChallengeResponseRequest {
	return &NullableAuthenticatorEmailChallengeResponseRequest{value: val, isSet: true}
}

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

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