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

// CommonCarFlashpackVersionRequest common car flashpack version request
//
// swagger:model common.CarFlashpackVersionRequest
type CommonCarFlashpackVersionRequest struct {

	// car model
	// Required: true
	CarModel *string `json:"car_model"`

	// car trim
	// Required: true
	CarTrim *string `json:"car_trim"`

	// car year
	// Required: true
	CarYear *int64 `json:"car_year"`

	// flashpack
	// Required: true
	Flashpack *string `json:"flashpack"`
}

// Validate validates this common car flashpack version request
func (m *CommonCarFlashpackVersionRequest) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

func (m *CommonCarFlashpackVersionRequest) validateCarModel(formats strfmt.Registry) error {

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

	return nil
}

func (m *CommonCarFlashpackVersionRequest) validateCarTrim(formats strfmt.Registry) error {

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

	return nil
}

func (m *CommonCarFlashpackVersionRequest) validateCarYear(formats strfmt.Registry) error {

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

	return nil
}

func (m *CommonCarFlashpackVersionRequest) validateFlashpack(formats strfmt.Registry) error {

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

	return nil
}

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

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

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