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

// LogoutURL Data for a single logout URL
type LogoutURL struct {
	Url                  string         `json:"url"`
	ProviderName         NullableString `json:"provider_name,omitempty"`
	Binding              NullableString `json:"binding,omitempty"`
	SamlRequest          NullableString `json:"saml_request,omitempty"`
	SamlResponse         NullableString `json:"saml_response,omitempty"`
	SamlRelayState       NullableString `json:"saml_relay_state,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _LogoutURL LogoutURL

// NewLogoutURL instantiates a new LogoutURL 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 NewLogoutURL(url string) *LogoutURL {
	this := LogoutURL{}
	this.Url = url
	return &this
}

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

// GetUrl returns the Url field value
func (o *LogoutURL) GetUrl() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Url
}

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

// SetUrl sets field value
func (o *LogoutURL) SetUrl(v string) {
	o.Url = v
}

// GetProviderName returns the ProviderName field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *LogoutURL) GetProviderName() string {
	if o == nil || IsNil(o.ProviderName.Get()) {
		var ret string
		return ret
	}
	return *o.ProviderName.Get()
}

// GetProviderNameOk returns a tuple with the ProviderName field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *LogoutURL) GetProviderNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.ProviderName.Get(), o.ProviderName.IsSet()
}

// HasProviderName returns a boolean if a field has been set.
func (o *LogoutURL) HasProviderName() bool {
	if o != nil && o.ProviderName.IsSet() {
		return true
	}

	return false
}

// SetProviderName gets a reference to the given NullableString and assigns it to the ProviderName field.
func (o *LogoutURL) SetProviderName(v string) {
	o.ProviderName.Set(&v)
}

// SetProviderNameNil sets the value for ProviderName to be an explicit nil
func (o *LogoutURL) SetProviderNameNil() {
	o.ProviderName.Set(nil)
}

// UnsetProviderName ensures that no value is present for ProviderName, not even an explicit nil
func (o *LogoutURL) UnsetProviderName() {
	o.ProviderName.Unset()
}

// GetBinding returns the Binding field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *LogoutURL) GetBinding() string {
	if o == nil || IsNil(o.Binding.Get()) {
		var ret string
		return ret
	}
	return *o.Binding.Get()
}

// GetBindingOk returns a tuple with the Binding field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *LogoutURL) GetBindingOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.Binding.Get(), o.Binding.IsSet()
}

// HasBinding returns a boolean if a field has been set.
func (o *LogoutURL) HasBinding() bool {
	if o != nil && o.Binding.IsSet() {
		return true
	}

	return false
}

// SetBinding gets a reference to the given NullableString and assigns it to the Binding field.
func (o *LogoutURL) SetBinding(v string) {
	o.Binding.Set(&v)
}

// SetBindingNil sets the value for Binding to be an explicit nil
func (o *LogoutURL) SetBindingNil() {
	o.Binding.Set(nil)
}

// UnsetBinding ensures that no value is present for Binding, not even an explicit nil
func (o *LogoutURL) UnsetBinding() {
	o.Binding.Unset()
}

// GetSamlRequest returns the SamlRequest field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *LogoutURL) GetSamlRequest() string {
	if o == nil || IsNil(o.SamlRequest.Get()) {
		var ret string
		return ret
	}
	return *o.SamlRequest.Get()
}

// GetSamlRequestOk returns a tuple with the SamlRequest field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *LogoutURL) GetSamlRequestOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.SamlRequest.Get(), o.SamlRequest.IsSet()
}

// HasSamlRequest returns a boolean if a field has been set.
func (o *LogoutURL) HasSamlRequest() bool {
	if o != nil && o.SamlRequest.IsSet() {
		return true
	}

	return false
}

// SetSamlRequest gets a reference to the given NullableString and assigns it to the SamlRequest field.
func (o *LogoutURL) SetSamlRequest(v string) {
	o.SamlRequest.Set(&v)
}

// SetSamlRequestNil sets the value for SamlRequest to be an explicit nil
func (o *LogoutURL) SetSamlRequestNil() {
	o.SamlRequest.Set(nil)
}

// UnsetSamlRequest ensures that no value is present for SamlRequest, not even an explicit nil
func (o *LogoutURL) UnsetSamlRequest() {
	o.SamlRequest.Unset()
}

// GetSamlResponse returns the SamlResponse field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *LogoutURL) GetSamlResponse() string {
	if o == nil || IsNil(o.SamlResponse.Get()) {
		var ret string
		return ret
	}
	return *o.SamlResponse.Get()
}

// GetSamlResponseOk returns a tuple with the SamlResponse field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *LogoutURL) GetSamlResponseOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.SamlResponse.Get(), o.SamlResponse.IsSet()
}

// HasSamlResponse returns a boolean if a field has been set.
func (o *LogoutURL) HasSamlResponse() bool {
	if o != nil && o.SamlResponse.IsSet() {
		return true
	}

	return false
}

// SetSamlResponse gets a reference to the given NullableString and assigns it to the SamlResponse field.
func (o *LogoutURL) SetSamlResponse(v string) {
	o.SamlResponse.Set(&v)
}

// SetSamlResponseNil sets the value for SamlResponse to be an explicit nil
func (o *LogoutURL) SetSamlResponseNil() {
	o.SamlResponse.Set(nil)
}

// UnsetSamlResponse ensures that no value is present for SamlResponse, not even an explicit nil
func (o *LogoutURL) UnsetSamlResponse() {
	o.SamlResponse.Unset()
}

// GetSamlRelayState returns the SamlRelayState field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *LogoutURL) GetSamlRelayState() string {
	if o == nil || IsNil(o.SamlRelayState.Get()) {
		var ret string
		return ret
	}
	return *o.SamlRelayState.Get()
}

// GetSamlRelayStateOk returns a tuple with the SamlRelayState field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *LogoutURL) GetSamlRelayStateOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.SamlRelayState.Get(), o.SamlRelayState.IsSet()
}

// HasSamlRelayState returns a boolean if a field has been set.
func (o *LogoutURL) HasSamlRelayState() bool {
	if o != nil && o.SamlRelayState.IsSet() {
		return true
	}

	return false
}

// SetSamlRelayState gets a reference to the given NullableString and assigns it to the SamlRelayState field.
func (o *LogoutURL) SetSamlRelayState(v string) {
	o.SamlRelayState.Set(&v)
}

// SetSamlRelayStateNil sets the value for SamlRelayState to be an explicit nil
func (o *LogoutURL) SetSamlRelayStateNil() {
	o.SamlRelayState.Set(nil)
}

// UnsetSamlRelayState ensures that no value is present for SamlRelayState, not even an explicit nil
func (o *LogoutURL) UnsetSamlRelayState() {
	o.SamlRelayState.Unset()
}

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

func (o LogoutURL) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["url"] = o.Url
	if o.ProviderName.IsSet() {
		toSerialize["provider_name"] = o.ProviderName.Get()
	}
	if o.Binding.IsSet() {
		toSerialize["binding"] = o.Binding.Get()
	}
	if o.SamlRequest.IsSet() {
		toSerialize["saml_request"] = o.SamlRequest.Get()
	}
	if o.SamlResponse.IsSet() {
		toSerialize["saml_response"] = o.SamlResponse.Get()
	}
	if o.SamlRelayState.IsSet() {
		toSerialize["saml_relay_state"] = o.SamlRelayState.Get()
	}

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

	return toSerialize, nil
}

func (o *LogoutURL) 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{
		"url",
	}

	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)
		}
	}

	varLogoutURL := _LogoutURL{}

	err = json.Unmarshal(data, &varLogoutURL)

	if err != nil {
		return err
	}

	*o = LogoutURL(varLogoutURL)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "url")
		delete(additionalProperties, "provider_name")
		delete(additionalProperties, "binding")
		delete(additionalProperties, "saml_request")
		delete(additionalProperties, "saml_response")
		delete(additionalProperties, "saml_relay_state")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableLogoutURL struct {
	value *LogoutURL
	isSet bool
}

func (v NullableLogoutURL) Get() *LogoutURL {
	return v.value
}

func (v *NullableLogoutURL) Set(val *LogoutURL) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableLogoutURL(val *LogoutURL) *NullableLogoutURL {
	return &NullableLogoutURL{value: val, isSet: true}
}

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

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