/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

import (
	"encoding/json"
	"fmt"
)

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

// OidcConfig struct for OidcConfig
type OidcConfig struct {
	// OIDC issuer
	Issuer string `json:"issuer"`
	// OIDC client ID
	ClientId string `json:"clientId"`
	// OIDC audience
	Audience string `json:"audience"`
	AdditionalProperties map[string]interface{}
}

type _OidcConfig OidcConfig

// NewOidcConfig instantiates a new OidcConfig 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 NewOidcConfig(issuer string, clientId string, audience string) *OidcConfig {
	this := OidcConfig{}
	this.Issuer = issuer
	this.ClientId = clientId
	this.Audience = audience
	return &this
}

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

// GetIssuer returns the Issuer field value
func (o *OidcConfig) GetIssuer() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Issuer
}

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

// SetIssuer sets field value
func (o *OidcConfig) SetIssuer(v string) {
	o.Issuer = v
}

// GetClientId returns the ClientId field value
func (o *OidcConfig) GetClientId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ClientId
}

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

// SetClientId sets field value
func (o *OidcConfig) SetClientId(v string) {
	o.ClientId = v
}

// GetAudience returns the Audience field value
func (o *OidcConfig) GetAudience() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Audience
}

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

// SetAudience sets field value
func (o *OidcConfig) SetAudience(v string) {
	o.Audience = v
}

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

func (o OidcConfig) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["issuer"] = o.Issuer
	toSerialize["clientId"] = o.ClientId
	toSerialize["audience"] = o.Audience

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

	return toSerialize, nil
}

func (o *OidcConfig) 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{
		"issuer",
		"clientId",
		"audience",
	}

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

	varOidcConfig := _OidcConfig{}

	err = json.Unmarshal(data, &varOidcConfig)

	if err != nil {
		return err
	}

	*o = OidcConfig(varOidcConfig)

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

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

	return err
}

type NullableOidcConfig struct {
	value *OidcConfig
	isSet bool
}

func (v NullableOidcConfig) Get() *OidcConfig {
	return v.value
}

func (v *NullableOidcConfig) Set(val *OidcConfig) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableOidcConfig(val *OidcConfig) *NullableOidcConfig {
	return &NullableOidcConfig{value: val, isSet: true}
}

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

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


