/*
Lethean Blockchain API

OpenAPI for Lethean Blockchain

API version: 6.0.1
*/

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

package lthn

import (
	"encoding/json"
)

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

// BlockTemplateModel struct for BlockTemplateModel
type BlockTemplateModel struct {
	BlocktemplateBlob *string `json:"blocktemplate_blob,omitempty"`
	Difficulty *string `json:"difficulty,omitempty"`
	Height *int32 `json:"height,omitempty"`
	MinerTxTgc *TxGenerationContextModel `json:"miner_tx_tgc,omitempty"`
	BlockRewardWithoutFee *int32 `json:"block_reward_without_fee,omitempty"`
	BlockReward *int32 `json:"block_reward,omitempty"`
	TxsFee *int32 `json:"txs_fee,omitempty"`
	PrevHash *string `json:"prev_hash,omitempty"`
	Seed *string `json:"seed,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _BlockTemplateModel BlockTemplateModel

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

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

// GetBlocktemplateBlob returns the BlocktemplateBlob field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetBlocktemplateBlob() string {
	if o == nil || IsNil(o.BlocktemplateBlob) {
		var ret string
		return ret
	}
	return *o.BlocktemplateBlob
}

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

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

	return false
}

// SetBlocktemplateBlob gets a reference to the given string and assigns it to the BlocktemplateBlob field.
func (o *BlockTemplateModel) SetBlocktemplateBlob(v string) {
	o.BlocktemplateBlob = &v
}

// GetDifficulty returns the Difficulty field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetDifficulty() string {
	if o == nil || IsNil(o.Difficulty) {
		var ret string
		return ret
	}
	return *o.Difficulty
}

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

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

	return false
}

// SetDifficulty gets a reference to the given string and assigns it to the Difficulty field.
func (o *BlockTemplateModel) SetDifficulty(v string) {
	o.Difficulty = &v
}

// GetHeight returns the Height field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetHeight() int32 {
	if o == nil || IsNil(o.Height) {
		var ret int32
		return ret
	}
	return *o.Height
}

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

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

	return false
}

// SetHeight gets a reference to the given int32 and assigns it to the Height field.
func (o *BlockTemplateModel) SetHeight(v int32) {
	o.Height = &v
}

// GetMinerTxTgc returns the MinerTxTgc field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetMinerTxTgc() TxGenerationContextModel {
	if o == nil || IsNil(o.MinerTxTgc) {
		var ret TxGenerationContextModel
		return ret
	}
	return *o.MinerTxTgc
}

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

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

	return false
}

// SetMinerTxTgc gets a reference to the given TxGenerationContextModel and assigns it to the MinerTxTgc field.
func (o *BlockTemplateModel) SetMinerTxTgc(v TxGenerationContextModel) {
	o.MinerTxTgc = &v
}

// GetBlockRewardWithoutFee returns the BlockRewardWithoutFee field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetBlockRewardWithoutFee() int32 {
	if o == nil || IsNil(o.BlockRewardWithoutFee) {
		var ret int32
		return ret
	}
	return *o.BlockRewardWithoutFee
}

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

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

	return false
}

// SetBlockRewardWithoutFee gets a reference to the given int32 and assigns it to the BlockRewardWithoutFee field.
func (o *BlockTemplateModel) SetBlockRewardWithoutFee(v int32) {
	o.BlockRewardWithoutFee = &v
}

// GetBlockReward returns the BlockReward field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetBlockReward() int32 {
	if o == nil || IsNil(o.BlockReward) {
		var ret int32
		return ret
	}
	return *o.BlockReward
}

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

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

	return false
}

// SetBlockReward gets a reference to the given int32 and assigns it to the BlockReward field.
func (o *BlockTemplateModel) SetBlockReward(v int32) {
	o.BlockReward = &v
}

// GetTxsFee returns the TxsFee field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetTxsFee() int32 {
	if o == nil || IsNil(o.TxsFee) {
		var ret int32
		return ret
	}
	return *o.TxsFee
}

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

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

	return false
}

// SetTxsFee gets a reference to the given int32 and assigns it to the TxsFee field.
func (o *BlockTemplateModel) SetTxsFee(v int32) {
	o.TxsFee = &v
}

// GetPrevHash returns the PrevHash field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetPrevHash() string {
	if o == nil || IsNil(o.PrevHash) {
		var ret string
		return ret
	}
	return *o.PrevHash
}

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

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

	return false
}

// SetPrevHash gets a reference to the given string and assigns it to the PrevHash field.
func (o *BlockTemplateModel) SetPrevHash(v string) {
	o.PrevHash = &v
}

// GetSeed returns the Seed field value if set, zero value otherwise.
func (o *BlockTemplateModel) GetSeed() string {
	if o == nil || IsNil(o.Seed) {
		var ret string
		return ret
	}
	return *o.Seed
}

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

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

	return false
}

// SetSeed gets a reference to the given string and assigns it to the Seed field.
func (o *BlockTemplateModel) SetSeed(v string) {
	o.Seed = &v
}

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

func (o BlockTemplateModel) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.BlocktemplateBlob) {
		toSerialize["blocktemplate_blob"] = o.BlocktemplateBlob
	}
	if !IsNil(o.Difficulty) {
		toSerialize["difficulty"] = o.Difficulty
	}
	if !IsNil(o.Height) {
		toSerialize["height"] = o.Height
	}
	if !IsNil(o.MinerTxTgc) {
		toSerialize["miner_tx_tgc"] = o.MinerTxTgc
	}
	if !IsNil(o.BlockRewardWithoutFee) {
		toSerialize["block_reward_without_fee"] = o.BlockRewardWithoutFee
	}
	if !IsNil(o.BlockReward) {
		toSerialize["block_reward"] = o.BlockReward
	}
	if !IsNil(o.TxsFee) {
		toSerialize["txs_fee"] = o.TxsFee
	}
	if !IsNil(o.PrevHash) {
		toSerialize["prev_hash"] = o.PrevHash
	}
	if !IsNil(o.Seed) {
		toSerialize["seed"] = o.Seed
	}

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *BlockTemplateModel) UnmarshalJSON(data []byte) (err error) {
	varBlockTemplateModel := _BlockTemplateModel{}

	err = json.Unmarshal(data, &varBlockTemplateModel)

	if err != nil {
		return err
	}

	*o = BlockTemplateModel(varBlockTemplateModel)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "blocktemplate_blob")
		delete(additionalProperties, "difficulty")
		delete(additionalProperties, "height")
		delete(additionalProperties, "miner_tx_tgc")
		delete(additionalProperties, "block_reward_without_fee")
		delete(additionalProperties, "block_reward")
		delete(additionalProperties, "txs_fee")
		delete(additionalProperties, "prev_hash")
		delete(additionalProperties, "seed")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableBlockTemplateModel struct {
	value *BlockTemplateModel
	isSet bool
}

func (v NullableBlockTemplateModel) Get() *BlockTemplateModel {
	return v.value
}

func (v *NullableBlockTemplateModel) Set(val *BlockTemplateModel) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBlockTemplateModel(val *BlockTemplateModel) *NullableBlockTemplateModel {
	return &NullableBlockTemplateModel{value: val, isSet: true}
}

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

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


