/*
Adyen BinLookup API

API version: 54
*/

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

package binlookup

import (
	"encoding/json"

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

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

// CostEstimateResponse struct for CostEstimateResponse
type CostEstimateResponse struct {
	CardBin            *CardBin `json:"cardBin,omitempty"`
	CostEstimateAmount *Amount  `json:"costEstimateAmount,omitempty"`
	// Adyen's 16-character reference associated with the request.
	CostEstimateReference *string `json:"costEstimateReference,omitempty"`
	// The result of the cost estimation.
	ResultCode *string `json:"resultCode,omitempty"`
}

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

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

// GetCardBin returns the CardBin field value if set, zero value otherwise.
func (o *CostEstimateResponse) GetCardBin() CardBin {
	if o == nil || common.IsNil(o.CardBin) {
		var ret CardBin
		return ret
	}
	return *o.CardBin
}

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

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

	return false
}

// SetCardBin gets a reference to the given CardBin and assigns it to the CardBin field.
func (o *CostEstimateResponse) SetCardBin(v CardBin) {
	o.CardBin = &v
}

// GetCostEstimateAmount returns the CostEstimateAmount field value if set, zero value otherwise.
func (o *CostEstimateResponse) GetCostEstimateAmount() Amount {
	if o == nil || common.IsNil(o.CostEstimateAmount) {
		var ret Amount
		return ret
	}
	return *o.CostEstimateAmount
}

// GetCostEstimateAmountOk returns a tuple with the CostEstimateAmount field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CostEstimateResponse) GetCostEstimateAmountOk() (*Amount, bool) {
	if o == nil || common.IsNil(o.CostEstimateAmount) {
		return nil, false
	}
	return o.CostEstimateAmount, true
}

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

	return false
}

// SetCostEstimateAmount gets a reference to the given Amount and assigns it to the CostEstimateAmount field.
func (o *CostEstimateResponse) SetCostEstimateAmount(v Amount) {
	o.CostEstimateAmount = &v
}

// GetCostEstimateReference returns the CostEstimateReference field value if set, zero value otherwise.
func (o *CostEstimateResponse) GetCostEstimateReference() string {
	if o == nil || common.IsNil(o.CostEstimateReference) {
		var ret string
		return ret
	}
	return *o.CostEstimateReference
}

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

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

	return false
}

// SetCostEstimateReference gets a reference to the given string and assigns it to the CostEstimateReference field.
func (o *CostEstimateResponse) SetCostEstimateReference(v string) {
	o.CostEstimateReference = &v
}

// GetResultCode returns the ResultCode field value if set, zero value otherwise.
func (o *CostEstimateResponse) GetResultCode() string {
	if o == nil || common.IsNil(o.ResultCode) {
		var ret string
		return ret
	}
	return *o.ResultCode
}

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

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

	return false
}

// SetResultCode gets a reference to the given string and assigns it to the ResultCode field.
func (o *CostEstimateResponse) SetResultCode(v string) {
	o.ResultCode = &v
}

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

func (o CostEstimateResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.CardBin) {
		toSerialize["cardBin"] = o.CardBin
	}
	if !common.IsNil(o.CostEstimateAmount) {
		toSerialize["costEstimateAmount"] = o.CostEstimateAmount
	}
	if !common.IsNil(o.CostEstimateReference) {
		toSerialize["costEstimateReference"] = o.CostEstimateReference
	}
	if !common.IsNil(o.ResultCode) {
		toSerialize["resultCode"] = o.ResultCode
	}
	return toSerialize, nil
}

type NullableCostEstimateResponse struct {
	value *CostEstimateResponse
	isSet bool
}

func (v NullableCostEstimateResponse) Get() *CostEstimateResponse {
	return v.value
}

func (v *NullableCostEstimateResponse) Set(val *CostEstimateResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCostEstimateResponse(val *CostEstimateResponse) *NullableCostEstimateResponse {
	return &NullableCostEstimateResponse{value: val, isSet: true}
}

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

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