// 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"
	"encoding/json"

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

// CommonRemoteDiagnosticCommandRequest common remote diagnostic command request
//
// swagger:model common.RemoteDiagnosticCommandRequest
type CommonRemoteDiagnosticCommandRequest struct {

	// can net action
	CanNetAction string `json:"can_net_action,omitempty"`

	// command
	// Required: true
	// Enum: ["remote_reset","can_network","remote_ignition","read_ecu_versions","write_secoc_key"]
	Command *string `json:"command"`

	// ecu name
	EcuName string `json:"ecu_name,omitempty"`

	// ignition action
	IgnitionAction string `json:"ignition_action,omitempty"`

	// timeout
	Timeout int64 `json:"timeout,omitempty"`

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

// Validate validates this common remote diagnostic command request
func (m *CommonRemoteDiagnosticCommandRequest) 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
}

var commonRemoteDiagnosticCommandRequestTypeCommandPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["remote_reset","can_network","remote_ignition","read_ecu_versions","write_secoc_key"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		commonRemoteDiagnosticCommandRequestTypeCommandPropEnum = append(commonRemoteDiagnosticCommandRequestTypeCommandPropEnum, v)
	}
}

const (

	// CommonRemoteDiagnosticCommandRequestCommandRemoteReset captures enum value "remote_reset"
	CommonRemoteDiagnosticCommandRequestCommandRemoteReset string = "remote_reset"

	// CommonRemoteDiagnosticCommandRequestCommandCanNetwork captures enum value "can_network"
	CommonRemoteDiagnosticCommandRequestCommandCanNetwork string = "can_network"

	// CommonRemoteDiagnosticCommandRequestCommandRemoteIgnition captures enum value "remote_ignition"
	CommonRemoteDiagnosticCommandRequestCommandRemoteIgnition string = "remote_ignition"

	// CommonRemoteDiagnosticCommandRequestCommandReadEcuVersions captures enum value "read_ecu_versions"
	CommonRemoteDiagnosticCommandRequestCommandReadEcuVersions string = "read_ecu_versions"

	// CommonRemoteDiagnosticCommandRequestCommandWriteSecocKey captures enum value "write_secoc_key"
	CommonRemoteDiagnosticCommandRequestCommandWriteSecocKey string = "write_secoc_key"
)

// prop value enum
func (m *CommonRemoteDiagnosticCommandRequest) validateCommandEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, commonRemoteDiagnosticCommandRequestTypeCommandPropEnum, true); err != nil {
		return err
	}
	return nil
}

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

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

	// value enum
	if err := m.validateCommandEnum("command", "body", *m.Command); err != nil {
		return err
	}

	return nil
}

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

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

	return nil
}

// ContextValidate validates this common remote diagnostic command request based on context it is used
func (m *CommonRemoteDiagnosticCommandRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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