/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.5.3
*/

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

package hindsight

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

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

// BankTemplateManifest A bank template manifest for import/export.  Version field enables forward-compatible schema evolution: the API auto-upgrades older manifest versions to the current schema on import.
type BankTemplateManifest struct {
	// Manifest schema version (currently '1')
	Version string `json:"version"`
	Bank NullableBankTemplateConfig `json:"bank,omitempty"`
	MentalModels []BankTemplateMentalModel `json:"mental_models,omitempty"`
	Directives []BankTemplateDirective `json:"directives,omitempty"`
}

type _BankTemplateManifest BankTemplateManifest

// NewBankTemplateManifest instantiates a new BankTemplateManifest 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 NewBankTemplateManifest(version string) *BankTemplateManifest {
	this := BankTemplateManifest{}
	this.Version = version
	return &this
}

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

// GetVersion returns the Version field value
func (o *BankTemplateManifest) GetVersion() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Version
}

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

// SetVersion sets field value
func (o *BankTemplateManifest) SetVersion(v string) {
	o.Version = v
}

// GetBank returns the Bank field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *BankTemplateManifest) GetBank() BankTemplateConfig {
	if o == nil || IsNil(o.Bank.Get()) {
		var ret BankTemplateConfig
		return ret
	}
	return *o.Bank.Get()
}

// GetBankOk returns a tuple with the Bank field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *BankTemplateManifest) GetBankOk() (*BankTemplateConfig, bool) {
	if o == nil {
		return nil, false
	}
	return o.Bank.Get(), o.Bank.IsSet()
}

// HasBank returns a boolean if a field has been set.
func (o *BankTemplateManifest) HasBank() bool {
	if o != nil && o.Bank.IsSet() {
		return true
	}

	return false
}

// SetBank gets a reference to the given NullableBankTemplateConfig and assigns it to the Bank field.
func (o *BankTemplateManifest) SetBank(v BankTemplateConfig) {
	o.Bank.Set(&v)
}
// SetBankNil sets the value for Bank to be an explicit nil
func (o *BankTemplateManifest) SetBankNil() {
	o.Bank.Set(nil)
}

// UnsetBank ensures that no value is present for Bank, not even an explicit nil
func (o *BankTemplateManifest) UnsetBank() {
	o.Bank.Unset()
}

// GetMentalModels returns the MentalModels field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *BankTemplateManifest) GetMentalModels() []BankTemplateMentalModel {
	if o == nil {
		var ret []BankTemplateMentalModel
		return ret
	}
	return o.MentalModels
}

// GetMentalModelsOk returns a tuple with the MentalModels field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *BankTemplateManifest) GetMentalModelsOk() ([]BankTemplateMentalModel, bool) {
	if o == nil || IsNil(o.MentalModels) {
		return nil, false
	}
	return o.MentalModels, true
}

// HasMentalModels returns a boolean if a field has been set.
func (o *BankTemplateManifest) HasMentalModels() bool {
	if o != nil && !IsNil(o.MentalModels) {
		return true
	}

	return false
}

// SetMentalModels gets a reference to the given []BankTemplateMentalModel and assigns it to the MentalModels field.
func (o *BankTemplateManifest) SetMentalModels(v []BankTemplateMentalModel) {
	o.MentalModels = v
}

// GetDirectives returns the Directives field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *BankTemplateManifest) GetDirectives() []BankTemplateDirective {
	if o == nil {
		var ret []BankTemplateDirective
		return ret
	}
	return o.Directives
}

// GetDirectivesOk returns a tuple with the Directives field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *BankTemplateManifest) GetDirectivesOk() ([]BankTemplateDirective, bool) {
	if o == nil || IsNil(o.Directives) {
		return nil, false
	}
	return o.Directives, true
}

// HasDirectives returns a boolean if a field has been set.
func (o *BankTemplateManifest) HasDirectives() bool {
	if o != nil && !IsNil(o.Directives) {
		return true
	}

	return false
}

// SetDirectives gets a reference to the given []BankTemplateDirective and assigns it to the Directives field.
func (o *BankTemplateManifest) SetDirectives(v []BankTemplateDirective) {
	o.Directives = v
}

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

func (o BankTemplateManifest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["version"] = o.Version
	if o.Bank.IsSet() {
		toSerialize["bank"] = o.Bank.Get()
	}
	if o.MentalModels != nil {
		toSerialize["mental_models"] = o.MentalModels
	}
	if o.Directives != nil {
		toSerialize["directives"] = o.Directives
	}
	return toSerialize, nil
}

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

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

	varBankTemplateManifest := _BankTemplateManifest{}

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

	if err != nil {
		return err
	}

	*o = BankTemplateManifest(varBankTemplateManifest)

	return err
}

type NullableBankTemplateManifest struct {
	value *BankTemplateManifest
	isSet bool
}

func (v NullableBankTemplateManifest) Get() *BankTemplateManifest {
	return v.value
}

func (v *NullableBankTemplateManifest) Set(val *BankTemplateManifest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBankTemplateManifest(val *BankTemplateManifest) *NullableBankTemplateManifest {
	return &NullableBankTemplateManifest{value: val, isSet: true}
}

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

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


