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

// PostCharactersCharacterIDFittingsParamsBody post_characters_character_id_fittings_fitting
//
// fitting object
// swagger:model postCharactersCharacterIdFittingsParamsBody

type PostCharactersCharacterIDFittingsParamsBody struct {

	// post_characters_character_id_fittings_description
	//
	// description string
	// Required: true
	// Max Length: 500
	// Min Length: 0
	Description *string `json:"description"`

	// items
	// Required: true
	Items PostCharactersCharacterIDFittingsParamsBodyItems `json:"items"`

	// post_characters_character_id_fittings_name
	//
	// name string
	// Required: true
	// Max Length: 50
	// Min Length: 1
	Name *string `json:"name"`

	// post_characters_character_id_fittings_ship_type_id
	//
	// ship_type_id integer
	// Required: true
	ShipTypeID *int32 `json:"ship_type_id"`
}

/* polymorph postCharactersCharacterIdFittingsParamsBody description false */

/* polymorph postCharactersCharacterIdFittingsParamsBody items false */

/* polymorph postCharactersCharacterIdFittingsParamsBody name false */

/* polymorph postCharactersCharacterIdFittingsParamsBody ship_type_id false */

// Validate validates this post characters character Id fittings params body
func (m *PostCharactersCharacterIDFittingsParamsBody) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

func (m *PostCharactersCharacterIDFittingsParamsBody) validateDescription(formats strfmt.Registry) error {

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

	if err := validate.MinLength("description", "body", string(*m.Description), 0); err != nil {
		return err
	}

	if err := validate.MaxLength("description", "body", string(*m.Description), 500); err != nil {
		return err
	}

	return nil
}

func (m *PostCharactersCharacterIDFittingsParamsBody) validateItems(formats strfmt.Registry) error {

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

	return nil
}

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

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

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

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

	return nil
}

func (m *PostCharactersCharacterIDFittingsParamsBody) validateShipTypeID(formats strfmt.Registry) error {

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

	return nil
}

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

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