// 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 (
	strfmt "github.com/go-openapi/strfmt"

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

// GetUniverseSystemsSystemIDOKBodyPlanetsItems get_universe_systems_system_id_planet
//
// planet object
// swagger:model getUniverseSystemsSystemIdOKBodyPlanetsItems

type GetUniverseSystemsSystemIDOKBodyPlanetsItems struct {

	// get_universe_systems_system_id_moons
	//
	// moons array
	// Max Items: 1000
	Moons []int32 `json:"moons"`

	// get_universe_systems_system_id_planet_id
	//
	// planet_id integer
	// Required: true
	PlanetID *int32 `json:"planet_id"`
}

/* polymorph getUniverseSystemsSystemIdOKBodyPlanetsItems moons false */

/* polymorph getUniverseSystemsSystemIdOKBodyPlanetsItems planet_id false */

// Validate validates this get universe systems system Id o k body planets items
func (m *GetUniverseSystemsSystemIDOKBodyPlanetsItems) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateMoons(formats); err != nil {
		// prop
		res = append(res, err)
	}

	if err := m.validatePlanetID(formats); err != nil {
		// prop
		res = append(res, err)
	}

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

func (m *GetUniverseSystemsSystemIDOKBodyPlanetsItems) validateMoons(formats strfmt.Registry) error {

	if swag.IsZero(m.Moons) { // not required
		return nil
	}

	iMoonsSize := int64(len(m.Moons))

	if err := validate.MaxItems("moons", "body", iMoonsSize, 1000); err != nil {
		return err
	}

	return nil
}

func (m *GetUniverseSystemsSystemIDOKBodyPlanetsItems) validatePlanetID(formats strfmt.Registry) error {

	if err := validate.Required("planet_id", "body", m.PlanetID); err != nil {
		return err
	}

	return nil
}

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

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