/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.4.17
*/

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

package hindsight

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

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

// BankListResponse Response model for listing all banks.
type BankListResponse struct {
	Banks []BankListItem `json:"banks"`
}

type _BankListResponse BankListResponse

// NewBankListResponse instantiates a new BankListResponse 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 NewBankListResponse(banks []BankListItem) *BankListResponse {
	this := BankListResponse{}
	this.Banks = banks
	return &this
}

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

// GetBanks returns the Banks field value
func (o *BankListResponse) GetBanks() []BankListItem {
	if o == nil {
		var ret []BankListItem
		return ret
	}

	return o.Banks
}

// GetBanksOk returns a tuple with the Banks field value
// and a boolean to check if the value has been set.
func (o *BankListResponse) GetBanksOk() ([]BankListItem, bool) {
	if o == nil {
		return nil, false
	}
	return o.Banks, true
}

// SetBanks sets field value
func (o *BankListResponse) SetBanks(v []BankListItem) {
	o.Banks = v
}

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

func (o BankListResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["banks"] = o.Banks
	return toSerialize, nil
}

func (o *BankListResponse) 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{
		"banks",
	}

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

	varBankListResponse := _BankListResponse{}

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

	if err != nil {
		return err
	}

	*o = BankListResponse(varBankListResponse)

	return err
}

type NullableBankListResponse struct {
	value *BankListResponse
	isSet bool
}

func (v NullableBankListResponse) Get() *BankListResponse {
	return v.value
}

func (v *NullableBankListResponse) Set(val *BankListResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBankListResponse(val *BankListResponse) *NullableBankListResponse {
	return &NullableBankListResponse{value: val, isSet: true}
}

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

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


