/*
Management API

API version: 3
*/

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

package management

import (
	"encoding/json"

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

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

// Commission struct for Commission
type Commission struct {
	// A fixed commission fee, in minor units.
	FixedAmount *int64 `json:"fixedAmount,omitempty"`
	// A variable commission fee, in basis points.
	VariablePercentage *int64 `json:"variablePercentage,omitempty"`
}

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

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

// GetFixedAmount returns the FixedAmount field value if set, zero value otherwise.
func (o *Commission) GetFixedAmount() int64 {
	if o == nil || common.IsNil(o.FixedAmount) {
		var ret int64
		return ret
	}
	return *o.FixedAmount
}

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

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

	return false
}

// SetFixedAmount gets a reference to the given int64 and assigns it to the FixedAmount field.
func (o *Commission) SetFixedAmount(v int64) {
	o.FixedAmount = &v
}

// GetVariablePercentage returns the VariablePercentage field value if set, zero value otherwise.
func (o *Commission) GetVariablePercentage() int64 {
	if o == nil || common.IsNil(o.VariablePercentage) {
		var ret int64
		return ret
	}
	return *o.VariablePercentage
}

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

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

	return false
}

// SetVariablePercentage gets a reference to the given int64 and assigns it to the VariablePercentage field.
func (o *Commission) SetVariablePercentage(v int64) {
	o.VariablePercentage = &v
}

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

func (o Commission) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !common.IsNil(o.FixedAmount) {
		toSerialize["fixedAmount"] = o.FixedAmount
	}
	if !common.IsNil(o.VariablePercentage) {
		toSerialize["variablePercentage"] = o.VariablePercentage
	}
	return toSerialize, nil
}

type NullableCommission struct {
	value *Commission
	isSet bool
}

func (v NullableCommission) Get() *Commission {
	return v.value
}

func (v *NullableCommission) Set(val *Commission) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCommission(val *Commission) *NullableCommission {
	return &NullableCommission{value: val, isSet: true}
}

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

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