// 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"
)

// CollectorVersion collector version
//
// swagger:model CollectorVersion
type CollectorVersion struct {

	// True if Linux collector available
	// Read Only: true
	Has32bitLinux *bool `json:"has32bitLinux,omitempty"`

	// True if Windows collector available
	// Read Only: true
	Has32bitWindows *bool `json:"has32bitWindows,omitempty"`

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

	// True if collector is a required release
	// Read Only: true
	Mandatory *bool `json:"mandatory,omitempty"`

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

	// Release Epoch for official releases
	// Read Only: true
	ReleaseEpoch int64 `json:"releaseEpoch,omitempty"`

	// False for early release. True for general release
	// Read Only: true
	Stable *bool `json:"stable,omitempty"`
}

// Validate validates this collector version
func (m *CollectorVersion) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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

	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.contextValidateReleaseEpoch(ctx, formats); err != nil {
		res = append(res, err)
	}

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

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

func (m *CollectorVersion) contextValidateHas32bitLinux(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *CollectorVersion) contextValidateHas32bitWindows(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

func (m *CollectorVersion) 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 *CollectorVersion) 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 *CollectorVersion) 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 *CollectorVersion) contextValidateReleaseEpoch(ctx context.Context, formats strfmt.Registry) error {

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

	return nil
}

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

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

	return nil
}

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

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