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

// GetMarketsGroupsMarketGroupIDOKBody get_markets_groups_market_group_id_ok
//
// 200 ok object
// swagger:model getMarketsGroupsMarketGroupIdOKBody

type GetMarketsGroupsMarketGroupIDOKBody struct {

	// get_markets_groups_market_group_id_description
	//
	// description string
	// Required: true
	Description *string `json:"description"`

	// get_markets_groups_market_group_id_market_group_id
	//
	// market_group_id integer
	// Required: true
	MarketGroupID *int32 `json:"market_group_id"`

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

	// get_markets_groups_market_group_id_parent_group_id
	//
	// parent_group_id integer
	ParentGroupID int32 `json:"parent_group_id,omitempty"`

	// get_markets_groups_market_group_id_types
	//
	// types array
	// Required: true
	// Max Items: 5000
	Types []int32 `json:"types"`
}

/* polymorph getMarketsGroupsMarketGroupIdOKBody description false */

/* polymorph getMarketsGroupsMarketGroupIdOKBody market_group_id false */

/* polymorph getMarketsGroupsMarketGroupIdOKBody name false */

/* polymorph getMarketsGroupsMarketGroupIdOKBody parent_group_id false */

/* polymorph getMarketsGroupsMarketGroupIdOKBody types false */

// Validate validates this get markets groups market group Id o k body
func (m *GetMarketsGroupsMarketGroupIDOKBody) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

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

	return nil
}

func (m *GetMarketsGroupsMarketGroupIDOKBody) validateMarketGroupID(formats strfmt.Registry) error {

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

	return nil
}

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

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

	return nil
}

func (m *GetMarketsGroupsMarketGroupIDOKBody) validateTypes(formats strfmt.Registry) error {

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

	iTypesSize := int64(len(m.Types))

	if err := validate.MaxItems("types", "body", iTypesSize, 5000); err != nil {
		return err
	}

	return nil
}

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

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