// Code generated by github.com/fjl/gencodec. DO NOT EDIT.

package genesis

import (
	"encoding/json"
	"math/big"

	"github.com/celo-org/celo-blockchain/common/decimal/bigintstr"
	"github.com/celo-org/celo-blockchain/common/decimal/fixed"
)

var _ = (*GovernanceParametersMarshaling)(nil)

// MarshalJSON marshals as JSON.
func (g GovernanceParameters) MarshalJSON() ([]byte, error) {
	type GovernanceParameters struct {
		UseMultiSig             bool                 `json:"useMultiSig"`
		ConcurrentProposals     uint64               `json:"concurrentProposals"`
		MinDeposit              *bigintstr.BigIntStr `json:"minDeposit"`
		QueueExpiry             uint64               `json:"queueExpiry"`
		DequeueFrequency        uint64               `json:"dequeueFrequency"`
		ReferendumStageDuration uint64               `json:"referendumStageDuration"`
		ExecutionStageDuration  uint64               `json:"executionStageDuration"`
		ParticipationBaseline   *fixed.Fixed         `json:"participationBaseline"`
		ParticipationFloor      *fixed.Fixed         `json:"participationFloor"`
		BaselineUpdateFactor    *fixed.Fixed         `json:"baselineUpdateFactor"`
		BaselineQuorumFactor    *fixed.Fixed         `json:"baselineQuorumFactor"`
	}
	var enc GovernanceParameters
	enc.UseMultiSig = g.UseMultiSig
	enc.ConcurrentProposals = g.ConcurrentProposals
	enc.MinDeposit = (*bigintstr.BigIntStr)(g.MinDeposit)
	enc.QueueExpiry = g.QueueExpiry
	enc.DequeueFrequency = g.DequeueFrequency
	enc.ReferendumStageDuration = g.ReferendumStageDuration
	enc.ExecutionStageDuration = g.ExecutionStageDuration
	enc.ParticipationBaseline = g.ParticipationBaseline
	enc.ParticipationFloor = g.ParticipationFloor
	enc.BaselineUpdateFactor = g.BaselineUpdateFactor
	enc.BaselineQuorumFactor = g.BaselineQuorumFactor
	return json.Marshal(&enc)
}

// UnmarshalJSON unmarshals from JSON.
func (g *GovernanceParameters) UnmarshalJSON(input []byte) error {
	type GovernanceParameters struct {
		UseMultiSig             *bool                `json:"useMultiSig"`
		ConcurrentProposals     *uint64              `json:"concurrentProposals"`
		MinDeposit              *bigintstr.BigIntStr `json:"minDeposit"`
		QueueExpiry             *uint64              `json:"queueExpiry"`
		DequeueFrequency        *uint64              `json:"dequeueFrequency"`
		ReferendumStageDuration *uint64              `json:"referendumStageDuration"`
		ExecutionStageDuration  *uint64              `json:"executionStageDuration"`
		ParticipationBaseline   *fixed.Fixed         `json:"participationBaseline"`
		ParticipationFloor      *fixed.Fixed         `json:"participationFloor"`
		BaselineUpdateFactor    *fixed.Fixed         `json:"baselineUpdateFactor"`
		BaselineQuorumFactor    *fixed.Fixed         `json:"baselineQuorumFactor"`
	}
	var dec GovernanceParameters
	if err := json.Unmarshal(input, &dec); err != nil {
		return err
	}
	if dec.UseMultiSig != nil {
		g.UseMultiSig = *dec.UseMultiSig
	}
	if dec.ConcurrentProposals != nil {
		g.ConcurrentProposals = *dec.ConcurrentProposals
	}
	if dec.MinDeposit != nil {
		g.MinDeposit = (*big.Int)(dec.MinDeposit)
	}
	if dec.QueueExpiry != nil {
		g.QueueExpiry = *dec.QueueExpiry
	}
	if dec.DequeueFrequency != nil {
		g.DequeueFrequency = *dec.DequeueFrequency
	}
	if dec.ReferendumStageDuration != nil {
		g.ReferendumStageDuration = *dec.ReferendumStageDuration
	}
	if dec.ExecutionStageDuration != nil {
		g.ExecutionStageDuration = *dec.ExecutionStageDuration
	}
	if dec.ParticipationBaseline != nil {
		g.ParticipationBaseline = dec.ParticipationBaseline
	}
	if dec.ParticipationFloor != nil {
		g.ParticipationFloor = dec.ParticipationFloor
	}
	if dec.BaselineUpdateFactor != nil {
		g.BaselineUpdateFactor = dec.BaselineUpdateFactor
	}
	if dec.BaselineQuorumFactor != nil {
		g.BaselineQuorumFactor = dec.BaselineQuorumFactor
	}
	return nil
}
