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

// Billing20201105GetRunningStatementResponse GetRunningUsageResponse is the response message returned by the GetRunningStatement RPC.
//
// swagger:model billing_20201105GetRunningStatementResponse
type Billing20201105GetRunningStatementResponse struct {

	// running_statement is the current billing period's statement.
	RunningStatement *Billing20201105Statement `json:"running_statement,omitempty"`
}

// Validate validates this billing 20201105 get running statement response
func (m *Billing20201105GetRunningStatementResponse) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *Billing20201105GetRunningStatementResponse) validateRunningStatement(formats strfmt.Registry) error {
	if swag.IsZero(m.RunningStatement) { // not required
		return nil
	}

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

	return nil
}

// ContextValidate validate this billing 20201105 get running statement response based on the context it is used
func (m *Billing20201105GetRunningStatementResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

func (m *Billing20201105GetRunningStatementResponse) contextValidateRunningStatement(ctx context.Context, formats strfmt.Registry) error {

	if m.RunningStatement != nil {

		if swag.IsZero(m.RunningStatement) { // not required
			return nil
		}

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

	return nil
}

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

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