/*
Disputes API

API version: 30
*/

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

package disputes

import (
	"encoding/json"

	"github.com/adyen/adyen-go-api-library/v21/src/common"
)

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

// DefenseReason struct for DefenseReason
type DefenseReason struct {
	// Array of defense document types for a specific defense reason. Indicates the document types that you can submit to the schemes to defend this dispute, and whether they are required.
	DefenseDocumentTypes []DefenseDocumentType `json:"defenseDocumentTypes,omitempty"`
	// The defense reason code that was selected to defend this dispute.
	DefenseReasonCode string `json:"defenseReasonCode"`
	// Indicates if sufficient defense material has been supplied.
	Satisfied bool `json:"satisfied"`
}

// NewDefenseReason instantiates a new DefenseReason 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 NewDefenseReason(defenseReasonCode string, satisfied bool) *DefenseReason {
	this := DefenseReason{}
	this.DefenseReasonCode = defenseReasonCode
	this.Satisfied = satisfied
	return &this
}

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

// GetDefenseDocumentTypes returns the DefenseDocumentTypes field value if set, zero value otherwise.
func (o *DefenseReason) GetDefenseDocumentTypes() []DefenseDocumentType {
	if o == nil || common.IsNil(o.DefenseDocumentTypes) {
		var ret []DefenseDocumentType
		return ret
	}
	return o.DefenseDocumentTypes
}

// GetDefenseDocumentTypesOk returns a tuple with the DefenseDocumentTypes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DefenseReason) GetDefenseDocumentTypesOk() ([]DefenseDocumentType, bool) {
	if o == nil || common.IsNil(o.DefenseDocumentTypes) {
		return nil, false
	}
	return o.DefenseDocumentTypes, true
}

// HasDefenseDocumentTypes returns a boolean if a field has been set.
func (o *DefenseReason) HasDefenseDocumentTypes() bool {
	if o != nil && !common.IsNil(o.DefenseDocumentTypes) {
		return true
	}

	return false
}

// SetDefenseDocumentTypes gets a reference to the given []DefenseDocumentType and assigns it to the DefenseDocumentTypes field.
func (o *DefenseReason) SetDefenseDocumentTypes(v []DefenseDocumentType) {
	o.DefenseDocumentTypes = v
}

// GetDefenseReasonCode returns the DefenseReasonCode field value
func (o *DefenseReason) GetDefenseReasonCode() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.DefenseReasonCode
}

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

// SetDefenseReasonCode sets field value
func (o *DefenseReason) SetDefenseReasonCode(v string) {
	o.DefenseReasonCode = v
}

// GetSatisfied returns the Satisfied field value
func (o *DefenseReason) GetSatisfied() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.Satisfied
}

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

// SetSatisfied sets field value
func (o *DefenseReason) SetSatisfied(v bool) {
	o.Satisfied = v
}

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

func (o DefenseReason) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.DefenseDocumentTypes) {
		toSerialize["defenseDocumentTypes"] = o.DefenseDocumentTypes
	}
	toSerialize["defenseReasonCode"] = o.DefenseReasonCode
	toSerialize["satisfied"] = o.Satisfied
	return toSerialize, nil
}

type NullableDefenseReason struct {
	value *DefenseReason
	isSet bool
}

func (v NullableDefenseReason) Get() *DefenseReason {
	return v.value
}

func (v *NullableDefenseReason) Set(val *DefenseReason) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDefenseReason(val *DefenseReason) *NullableDefenseReason {
	return &NullableDefenseReason{value: val, isSet: true}
}

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

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