// 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 (
	"context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// CommonBulkCarCommands common bulk car commands
//
// swagger:model common.BulkCarCommands
type CommonBulkCarCommands struct {

	// command
	// Required: true
	// Max Length: 100
	Command *string `json:"command"`

	// data
	Data string `json:"data,omitempty"`

	// end
	End string `json:"end,omitempty"`

	// start
	Start string `json:"start,omitempty"`

	// timestamp
	Timestamp string `json:"timestamp,omitempty"`

	// vins
	// Required: true
	Vins []string `json:"vins"`
}

// Validate validates this common bulk car commands
func (m *CommonBulkCarCommands) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *CommonBulkCarCommands) validateCommand(formats strfmt.Registry) error {

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

	if err := validate.MaxLength("command", "body", *m.Command, 100); err != nil {
		return err
	}

	return nil
}

func (m *CommonBulkCarCommands) validateVins(formats strfmt.Registry) error {

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

	return nil
}

// ContextValidate validates this common bulk car commands based on context it is used
func (m *CommonBulkCarCommands) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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