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

// GetCharactersCharacterIDBookmarksOKBodyItemsTarget get_characters_character_id_bookmarks_target
//
// target object
// swagger:model getCharactersCharacterIdBookmarksOKBodyItemsTarget

type GetCharactersCharacterIDBookmarksOKBodyItemsTarget struct {

	// coordinates
	Coordinates *GetCharactersCharacterIDBookmarksOKBodyItemsTargetCoordinates `json:"coordinates,omitempty"`

	// item
	Item *GetCharactersCharacterIDBookmarksOKBodyItemsTargetItem `json:"item,omitempty"`

	// get_characters_character_id_bookmarks_location_id
	//
	// location_id integer
	// Required: true
	LocationID *int64 `json:"location_id"`
}

/* polymorph getCharactersCharacterIdBookmarksOKBodyItemsTarget coordinates false */

/* polymorph getCharactersCharacterIdBookmarksOKBodyItemsTarget item false */

/* polymorph getCharactersCharacterIdBookmarksOKBodyItemsTarget location_id false */

// Validate validates this get characters character Id bookmarks o k body items target
func (m *GetCharactersCharacterIDBookmarksOKBodyItemsTarget) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

func (m *GetCharactersCharacterIDBookmarksOKBodyItemsTarget) validateCoordinates(formats strfmt.Registry) error {

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

	if m.Coordinates != nil {

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

	return nil
}

func (m *GetCharactersCharacterIDBookmarksOKBodyItemsTarget) validateItem(formats strfmt.Registry) error {

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

	if m.Item != nil {

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

	return nil
}

func (m *GetCharactersCharacterIDBookmarksOKBodyItemsTarget) validateLocationID(formats strfmt.Registry) error {

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

	return nil
}

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

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