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

// GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems get_characters_character_id_planets_planet_id_route
//
// route object
// swagger:model getCharactersCharacterIdPlanetsPlanetIdOKBodyRoutesItems

type GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems struct {

	// get_characters_character_id_planets_planet_id_content_type_id
	//
	// content_type_id integer
	// Required: true
	ContentTypeID *int32 `json:"content_type_id"`

	// get_characters_character_id_planets_planet_id_destination_pin_id
	//
	// destination_pin_id integer
	// Required: true
	DestinationPinID *int64 `json:"destination_pin_id"`

	// get_characters_character_id_planets_planet_id_quantity
	//
	// quantity number
	// Required: true
	Quantity *float32 `json:"quantity"`

	// get_characters_character_id_planets_planet_id_route_id
	//
	// route_id integer
	// Required: true
	RouteID *int64 `json:"route_id"`

	// get_characters_character_id_planets_planet_id_source_pin_id
	//
	// source_pin_id integer
	// Required: true
	SourcePinID *int64 `json:"source_pin_id"`

	// get_characters_character_id_planets_planet_id_waypoints
	//
	// list of pin ID waypoints
	// Max Items: 5
	Waypoints []int64 `json:"waypoints"`
}

/* polymorph getCharactersCharacterIdPlanetsPlanetIdOKBodyRoutesItems content_type_id false */

/* polymorph getCharactersCharacterIdPlanetsPlanetIdOKBodyRoutesItems destination_pin_id false */

/* polymorph getCharactersCharacterIdPlanetsPlanetIdOKBodyRoutesItems quantity false */

/* polymorph getCharactersCharacterIdPlanetsPlanetIdOKBodyRoutesItems route_id false */

/* polymorph getCharactersCharacterIdPlanetsPlanetIdOKBodyRoutesItems source_pin_id false */

/* polymorph getCharactersCharacterIdPlanetsPlanetIdOKBodyRoutesItems waypoints false */

// Validate validates this get characters character Id planets planet Id o k body routes items
func (m *GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

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

func (m *GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems) validateContentTypeID(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems) validateDestinationPinID(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems) validateQuantity(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems) validateRouteID(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems) validateSourcePinID(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetCharactersCharacterIDPlanetsPlanetIDOKBodyRoutesItems) validateWaypoints(formats strfmt.Registry) error {

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

	iWaypointsSize := int64(len(m.Waypoints))

	if err := validate.MaxItems("waypoints", "body", iWaypointsSize, 5); err != nil {
		return err
	}

	return nil
}

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

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