// 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 (
	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
)

// AgentRunner agent runner
//
// swagger:model agentRunner
type AgentRunner struct {

	// active session created at
	ActiveSessionCreatedAt string `json:"active_session_created_at,omitempty"`

	// attached file keys
	AttachedFileKeys []string `json:"attached_file_keys"`

	// base deploy id
	BaseDeployID string `json:"base_deploy_id,omitempty"`

	// branch
	Branch string `json:"branch,omitempty"`

	// created at
	CreatedAt string `json:"created_at,omitempty"`

	// current task
	CurrentTask string `json:"current_task,omitempty"`

	// done at
	DoneAt string `json:"done_at,omitempty"`

	// id
	ID string `json:"id,omitempty"`

	// latest session deploy id
	LatestSessionDeployID string `json:"latest_session_deploy_id,omitempty"`

	// latest session deploy url
	LatestSessionDeployURL string `json:"latest_session_deploy_url,omitempty"`

	// merge commit error
	MergeCommitError string `json:"merge_commit_error,omitempty"`

	// merge commit is being created
	MergeCommitIsBeingCreated bool `json:"merge_commit_is_being_created,omitempty"`

	// merge commit sha
	MergeCommitSha string `json:"merge_commit_sha,omitempty"`

	// parent agent runner id
	ParentAgentRunnerID string `json:"parent_agent_runner_id,omitempty"`

	// pr branch
	PrBranch string `json:"pr_branch,omitempty"`

	// pr error
	PrError string `json:"pr_error,omitempty"`

	// pr is being created
	PrIsBeingCreated bool `json:"pr_is_being_created,omitempty"`

	// pr number
	PrNumber int64 `json:"pr_number,omitempty"`

	// pr state
	PrState string `json:"pr_state,omitempty"`

	// pr url
	PrURL string `json:"pr_url,omitempty"`

	// result branch
	ResultBranch string `json:"result_branch,omitempty"`

	// result diff
	ResultDiff string `json:"result_diff,omitempty"`

	// sha
	Sha string `json:"sha,omitempty"`

	// site id
	SiteID string `json:"site_id,omitempty"`

	// state
	State string `json:"state,omitempty"`

	// title
	Title string `json:"title,omitempty"`

	// updated at
	UpdatedAt string `json:"updated_at,omitempty"`

	// user
	User *AgentRunnerUser `json:"user,omitempty"`
}

// Validate validates this agent runner
func (m *AgentRunner) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (m *AgentRunner) validateUser(formats strfmt.Registry) error {

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

	if m.User != nil {
		if err := m.User.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("user")
			}
			return err
		}
	}

	return nil
}

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

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