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

// GetUniverseMoonsMoonIDOKBody get_universe_moons_moon_id_ok
//
// 200 ok object
// swagger:model getUniverseMoonsMoonIdOKBody

type GetUniverseMoonsMoonIDOKBody struct {

	// get_universe_moons_moon_id_moon_id
	//
	// moon_id integer
	// Required: true
	MoonID *int32 `json:"moon_id"`

	// get_universe_moons_moon_id_name
	//
	// name string
	// Required: true
	Name *string `json:"name"`

	// position
	// Required: true
	Position *GetUniverseMoonsMoonIDOKBodyPosition `json:"position"`

	// get_universe_moons_moon_id_system_id
	//
	// The solar system this moon is in
	// Required: true
	SystemID *int32 `json:"system_id"`
}

/* polymorph getUniverseMoonsMoonIdOKBody moon_id false */

/* polymorph getUniverseMoonsMoonIdOKBody name false */

/* polymorph getUniverseMoonsMoonIdOKBody position false */

/* polymorph getUniverseMoonsMoonIdOKBody system_id false */

// Validate validates this get universe moons moon Id o k body
func (m *GetUniverseMoonsMoonIDOKBody) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

func (m *GetUniverseMoonsMoonIDOKBody) validateMoonID(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetUniverseMoonsMoonIDOKBody) validateName(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetUniverseMoonsMoonIDOKBody) validatePosition(formats strfmt.Registry) error {

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

	if m.Position != nil {

		if err := m.Position.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("position")
			}
			return err
		}
	}

	return nil
}

func (m *GetUniverseMoonsMoonIDOKBody) validateSystemID(formats strfmt.Registry) error {

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

	return nil
}

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

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