// 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 _ = (*GasPriceMinimumParametersMarshaling)(nil)

// MarshalJSON marshals as JSON.
func (g GasPriceMinimumParameters) MarshalJSON() ([]byte, error) {
	type GasPriceMinimumParameters struct {
		MinimumFloor                 *bigintstr.BigIntStr `json:"minimumFloor"`
		TargetDensity                *fixed.Fixed         `json:"targetDensity"`
		AdjustmentSpeed              *fixed.Fixed         `json:"adjustmentSpeed"`
		BaseFeeOpCodeActivationBlock *bigintstr.BigIntStr `json:"baseFeeOpCodeActivationBlock"`
	}
	var enc GasPriceMinimumParameters
	enc.MinimumFloor = (*bigintstr.BigIntStr)(g.MinimumFloor)
	enc.TargetDensity = g.TargetDensity
	enc.AdjustmentSpeed = g.AdjustmentSpeed
	enc.BaseFeeOpCodeActivationBlock = (*bigintstr.BigIntStr)(g.BaseFeeOpCodeActivationBlock)
	return json.Marshal(&enc)
}

// UnmarshalJSON unmarshals from JSON.
func (g *GasPriceMinimumParameters) UnmarshalJSON(input []byte) error {
	type GasPriceMinimumParameters struct {
		MinimumFloor                 *bigintstr.BigIntStr `json:"minimumFloor"`
		TargetDensity                *fixed.Fixed         `json:"targetDensity"`
		AdjustmentSpeed              *fixed.Fixed         `json:"adjustmentSpeed"`
		BaseFeeOpCodeActivationBlock *bigintstr.BigIntStr `json:"baseFeeOpCodeActivationBlock"`
	}
	var dec GasPriceMinimumParameters
	if err := json.Unmarshal(input, &dec); err != nil {
		return err
	}
	if dec.MinimumFloor != nil {
		g.MinimumFloor = (*big.Int)(dec.MinimumFloor)
	}
	if dec.TargetDensity != nil {
		g.TargetDensity = dec.TargetDensity
	}
	if dec.AdjustmentSpeed != nil {
		g.AdjustmentSpeed = dec.AdjustmentSpeed
	}
	if dec.BaseFeeOpCodeActivationBlock != nil {
		g.BaseFeeOpCodeActivationBlock = (*big.Int)(dec.BaseFeeOpCodeActivationBlock)
	}
	return nil
}
