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

// LogsProgressParams logs progress params
//
// swagger:model logs-progress-params
type LogsProgressParams struct {

	// The state of collecting logs.
	// Required: true
	LogsState *LogsState `json:"logs_state" gorm:"type:varchar(2048)"`
}

// Validate validates this logs progress params
func (m *LogsProgressParams) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *LogsProgressParams) validateLogsState(formats strfmt.Registry) error {

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

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

	if m.LogsState != nil {
		if err := m.LogsState.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("logs_state")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("logs_state")
			}
			return err
		}
	}

	return nil
}

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

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

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

func (m *LogsProgressParams) contextValidateLogsState(ctx context.Context, formats strfmt.Registry) error {

	if m.LogsState != nil {
		if err := m.LogsState.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("logs_state")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("logs_state")
			}
			return err
		}
	}

	return nil
}

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

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