/*
Test

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

API version: 1.0.0
*/

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

package openapi

import (
	"encoding/json"
	"bytes"
	"fmt"
)

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

// AdditionalData struct for AdditionalData
type AdditionalData struct {
	Prop1 string `json:"prop1"`
	Quantity int32 `json:"quantity"`
	UnitPrice float64 `json:"unitPrice"`
	TotalPrice float64 `json:"totalPrice"`
}

type _AdditionalData AdditionalData

// NewAdditionalData instantiates a new AdditionalData 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 NewAdditionalData(prop1 string, quantity int32, unitPrice float64, totalPrice float64) *AdditionalData {
	this := AdditionalData{}
	this.Prop1 = prop1
	this.Quantity = quantity
	this.UnitPrice = unitPrice
	this.TotalPrice = totalPrice
	return &this
}

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

// GetProp1 returns the Prop1 field value
func (o *AdditionalData) GetProp1() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Prop1
}

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

// SetProp1 sets field value
func (o *AdditionalData) SetProp1(v string) {
	o.Prop1 = v
}

// GetQuantity returns the Quantity field value
func (o *AdditionalData) GetQuantity() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Quantity
}

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

// SetQuantity sets field value
func (o *AdditionalData) SetQuantity(v int32) {
	o.Quantity = v
}

// GetUnitPrice returns the UnitPrice field value
func (o *AdditionalData) GetUnitPrice() float64 {
	if o == nil {
		var ret float64
		return ret
	}

	return o.UnitPrice
}

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

// SetUnitPrice sets field value
func (o *AdditionalData) SetUnitPrice(v float64) {
	o.UnitPrice = v
}

// GetTotalPrice returns the TotalPrice field value
func (o *AdditionalData) GetTotalPrice() float64 {
	if o == nil {
		var ret float64
		return ret
	}

	return o.TotalPrice
}

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

// SetTotalPrice sets field value
func (o *AdditionalData) SetTotalPrice(v float64) {
	o.TotalPrice = v
}

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

func (o AdditionalData) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["prop1"] = o.Prop1
	toSerialize["quantity"] = o.Quantity
	toSerialize["unitPrice"] = o.UnitPrice
	toSerialize["totalPrice"] = o.TotalPrice
	return toSerialize, nil
}

func (o *AdditionalData) 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{
		"prop1",
		"quantity",
		"unitPrice",
		"totalPrice",
	}

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

	varAdditionalData := _AdditionalData{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varAdditionalData)

	if err != nil {
		return err
	}

	*o = AdditionalData(varAdditionalData)

	return err
}

type NullableAdditionalData struct {
	value *AdditionalData
	isSet bool
}

func (v NullableAdditionalData) Get() *AdditionalData {
	return v.value
}

func (v *NullableAdditionalData) Set(val *AdditionalData) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAdditionalData(val *AdditionalData) *NullableAdditionalData {
	return &NullableAdditionalData{value: val, isSet: true}
}

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

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


