// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// NextUpgradeInfo next upgrade info
//
// swagger:model NextUpgradeInfo
type NextUpgradeInfo struct {

	// major version
	// Read Only: true
	MajorVersion int32 `json:"majorVersion,omitempty"`

	// mandatory
	// Read Only: true
	Mandatory *bool `json:"mandatory,omitempty"`

	// minor version
	// Read Only: true
	MinorVersion int32 `json:"minorVersion,omitempty"`

	// stable
	// Read Only: true
	Stable *bool `json:"stable,omitempty"`

	// upgrade time
	// Read Only: true
	UpgradeTime string `json:"upgradeTime,omitempty"`

	// upgrade time epoch
	// Read Only: true
	UpgradeTimeEpoch int64 `json:"upgradeTimeEpoch,omitempty"`
}

// Validate validates this next upgrade info
func (m *NextUpgradeInfo) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this next upgrade info based on the context it is used
func (m *NextUpgradeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := m.contextValidateMajorVersion(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateMandatory(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateMinorVersion(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateStable(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateUpgradeTime(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := m.contextValidateUpgradeTimeEpoch(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (m *NextUpgradeInfo) contextValidateMajorVersion(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "majorVersion", "body", int32(m.MajorVersion)); err != nil {
		return err
	}

	return nil
}

func (m *NextUpgradeInfo) contextValidateMandatory(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "mandatory", "body", m.Mandatory); err != nil {
		return err
	}

	return nil
}

func (m *NextUpgradeInfo) contextValidateMinorVersion(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "minorVersion", "body", int32(m.MinorVersion)); err != nil {
		return err
	}

	return nil
}

func (m *NextUpgradeInfo) contextValidateStable(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "stable", "body", m.Stable); err != nil {
		return err
	}

	return nil
}

func (m *NextUpgradeInfo) contextValidateUpgradeTime(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "upgradeTime", "body", string(m.UpgradeTime)); err != nil {
		return err
	}

	return nil
}

func (m *NextUpgradeInfo) contextValidateUpgradeTimeEpoch(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "upgradeTimeEpoch", "body", int64(m.UpgradeTimeEpoch)); err != nil {
		return err
	}

	return nil
}

// MarshalBinary interface implementation
func (m *NextUpgradeInfo) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *NextUpgradeInfo) UnmarshalBinary(b []byte) error {
	var res NextUpgradeInfo
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
