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

// Debug debug
//
// swagger:model Debug
type Debug struct {

	// The session prefix name
	CmdContext string `json:"cmdContext,omitempty"`

	// The debug command to execute
	Cmdline string `json:"cmdline,omitempty"`

	// The value of the debug command
	// Read Only: true
	Output string `json:"output,omitempty"`

	// The session id
	// Read Only: true
	SessionID string `json:"sessionId,omitempty"`
}

// Validate validates this debug
func (m *Debug) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validate this debug based on the context it is used
func (m *Debug) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *Debug) contextValidateOutput(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "output", "body", string(m.Output)); err != nil {
		return err
	}

	return nil
}

func (m *Debug) contextValidateSessionID(ctx context.Context, formats strfmt.Registry) error {

	if err := validate.ReadOnly(ctx, "sessionId", "body", string(m.SessionID)); err != nil {
		return err
	}

	return nil
}

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

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