/*
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"
	"fmt"
)

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

// PromptChoice Serializer for a single Choice field
type PromptChoice struct {
	Value                string `json:"value"`
	Label                string `json:"label"`
	AdditionalProperties map[string]interface{}
}

type _PromptChoice PromptChoice

// NewPromptChoice instantiates a new PromptChoice 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 NewPromptChoice(value string, label string) *PromptChoice {
	this := PromptChoice{}
	this.Value = value
	this.Label = label
	return &this
}

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

// GetValue returns the Value field value
func (o *PromptChoice) GetValue() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Value
}

// GetValueOk returns a tuple with the Value field value
// and a boolean to check if the value has been set.
func (o *PromptChoice) GetValueOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Value, true
}

// SetValue sets field value
func (o *PromptChoice) SetValue(v string) {
	o.Value = v
}

// GetLabel returns the Label field value
func (o *PromptChoice) GetLabel() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Label
}

// GetLabelOk returns a tuple with the Label field value
// and a boolean to check if the value has been set.
func (o *PromptChoice) GetLabelOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Label, true
}

// SetLabel sets field value
func (o *PromptChoice) SetLabel(v string) {
	o.Label = v
}

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

func (o PromptChoice) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["value"] = o.Value
	toSerialize["label"] = o.Label

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

	return toSerialize, nil
}

func (o *PromptChoice) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"value",
		"label",
	}

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

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err
	}

	for _, requiredProperty := range requiredProperties {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varPromptChoice := _PromptChoice{}

	err = json.Unmarshal(data, &varPromptChoice)

	if err != nil {
		return err
	}

	*o = PromptChoice(varPromptChoice)

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

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

	return err
}

type NullablePromptChoice struct {
	value *PromptChoice
	isSet bool
}

func (v NullablePromptChoice) Get() *PromptChoice {
	return v.value
}

func (v *NullablePromptChoice) Set(val *PromptChoice) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullablePromptChoice(val *PromptChoice) *NullablePromptChoice {
	return &NullablePromptChoice{value: val, isSet: true}
}

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

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