// Code generated by go-swagger; DO NOT EDIT.

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package devops_models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"

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

// Job job
//
// swagger:model Job
type Job struct {

	// Taxnexus Account Id
	// Required: true
	AccountID *string `json:"AccountID"`

	// Taxnexus Backend ID
	BackendID string `json:"BackendID,omitempty"`

	// Taxnexus Company ID
	CompanyID string `json:"CompanyID,omitempty"`

	// Taxnexus Coordinate ID
	CoordinateID string `json:"CoordinateID,omitempty"`

	// Taxnexus User ID
	CreatedByID string `json:"CreatedByID,omitempty"`

	// Date of Job Creation
	CreatedDate string `json:"CreatedDate,omitempty"`

	// The amount of time after the Start Time to perform one or more jobs
	// Required: true
	// Enum: [day document hour minute month quarter second week year]
	Duration *string `json:"Duration"`

	// End Date/Time
	EndDate string `json:"EndDate,omitempty"`

	// Error Reason
	ErrorReason string `json:"ErrorReason,omitempty"`

	// Taxnexus Record Id of the Job record
	ID string `json:"ID,omitempty"`

	// The time interval by which multiple jobs are executed within the Duration
	// Enum: [day each hour minute month quarter second week year]
	Interval string `json:"Interval,omitempty"`

	// Job Date
	JobDate string `json:"JobDate,omitempty"`

	// Last Modified By
	LastModifiedByID string `json:"LastModifiedByID,omitempty"`

	// Last Modified Date
	LastModifiedDate string `json:"LastModifiedDate,omitempty"`

	// The Month Number of the job
	Month int64 `json:"Month,omitempty"`

	// Next Job
	NextJobID string `json:"NextJobID,omitempty"`

	// The user ID that owns this job
	OwnerID string `json:"OwnerID,omitempty"`

	// The parameters needed to process the job
	Parameters string `json:"Parameters,omitempty"`

	// Period
	PeriodID string `json:"PeriodID,omitempty"`

	// The Month Number of the job
	Quarter int64 `json:"Quarter,omitempty"`

	// Rating Engine
	RatingEngineID string `json:"RatingEngineID,omitempty"`

	// External Reference
	Ref string `json:"Ref,omitempty"`

	// Reschedule?
	Reschedule bool `json:"Reschedule,omitempty"`

	// Reschedule Interval
	RescheduleInterval int64 `json:"RescheduleInterval,omitempty"`

	// The Saga ID used to link log entries and transactions
	SagaID string `json:"SagaID,omitempty"`

	// The type of Saga transaction being performed
	// Required: true
	SagaType *string `json:"SagaType"`

	// The Month Number of the job
	Semiannual int64 `json:"Semiannual,omitempty"`

	// The source system that generated this job
	// Enum: [api fabric taxnexus telnexus]
	Source string `json:"Source,omitempty"`

	// Start Date/Time
	StartDate string `json:"StartDate,omitempty"`

	// Status
	// Enum: [active complete error new queued]
	Status string `json:"Status,omitempty"`

	// The target system that executes this job
	// Enum: [api fabric taxnexus telnexus]
	Target string `json:"Target,omitempty"`

	// ID of the Tenant that owns this Object Instance
	TenantID string `json:"TenantID,omitempty"`

	// The Month Number of the job
	Year int64 `json:"Year,omitempty"`
}

// Validate validates this job
func (m *Job) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

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

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

func (m *Job) validateAccountID(formats strfmt.Registry) error {

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

	return nil
}

var jobTypeDurationPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["day","document","hour","minute","month","quarter","second","week","year"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		jobTypeDurationPropEnum = append(jobTypeDurationPropEnum, v)
	}
}

const (

	// JobDurationDay captures enum value "day"
	JobDurationDay string = "day"

	// JobDurationDocument captures enum value "document"
	JobDurationDocument string = "document"

	// JobDurationHour captures enum value "hour"
	JobDurationHour string = "hour"

	// JobDurationMinute captures enum value "minute"
	JobDurationMinute string = "minute"

	// JobDurationMonth captures enum value "month"
	JobDurationMonth string = "month"

	// JobDurationQuarter captures enum value "quarter"
	JobDurationQuarter string = "quarter"

	// JobDurationSecond captures enum value "second"
	JobDurationSecond string = "second"

	// JobDurationWeek captures enum value "week"
	JobDurationWeek string = "week"

	// JobDurationYear captures enum value "year"
	JobDurationYear string = "year"
)

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

func (m *Job) validateDuration(formats strfmt.Registry) error {

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

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

	return nil
}

var jobTypeIntervalPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["day","each","hour","minute","month","quarter","second","week","year"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		jobTypeIntervalPropEnum = append(jobTypeIntervalPropEnum, v)
	}
}

const (

	// JobIntervalDay captures enum value "day"
	JobIntervalDay string = "day"

	// JobIntervalEach captures enum value "each"
	JobIntervalEach string = "each"

	// JobIntervalHour captures enum value "hour"
	JobIntervalHour string = "hour"

	// JobIntervalMinute captures enum value "minute"
	JobIntervalMinute string = "minute"

	// JobIntervalMonth captures enum value "month"
	JobIntervalMonth string = "month"

	// JobIntervalQuarter captures enum value "quarter"
	JobIntervalQuarter string = "quarter"

	// JobIntervalSecond captures enum value "second"
	JobIntervalSecond string = "second"

	// JobIntervalWeek captures enum value "week"
	JobIntervalWeek string = "week"

	// JobIntervalYear captures enum value "year"
	JobIntervalYear string = "year"
)

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

func (m *Job) validateInterval(formats strfmt.Registry) error {

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

	// value enum
	if err := m.validateIntervalEnum("Interval", "body", m.Interval); err != nil {
		return err
	}

	return nil
}

func (m *Job) validateSagaType(formats strfmt.Registry) error {

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

	return nil
}

var jobTypeSourcePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["api","fabric","taxnexus","telnexus"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		jobTypeSourcePropEnum = append(jobTypeSourcePropEnum, v)
	}
}

const (

	// JobSourceAPI captures enum value "api"
	JobSourceAPI string = "api"

	// JobSourceFabric captures enum value "fabric"
	JobSourceFabric string = "fabric"

	// JobSourceTaxnexus captures enum value "taxnexus"
	JobSourceTaxnexus string = "taxnexus"

	// JobSourceTelnexus captures enum value "telnexus"
	JobSourceTelnexus string = "telnexus"
)

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

func (m *Job) validateSource(formats strfmt.Registry) error {

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

	// value enum
	if err := m.validateSourceEnum("Source", "body", m.Source); err != nil {
		return err
	}

	return nil
}

var jobTypeStatusPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["active","complete","error","new","queued"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		jobTypeStatusPropEnum = append(jobTypeStatusPropEnum, v)
	}
}

const (

	// JobStatusActive captures enum value "active"
	JobStatusActive string = "active"

	// JobStatusComplete captures enum value "complete"
	JobStatusComplete string = "complete"

	// JobStatusError captures enum value "error"
	JobStatusError string = "error"

	// JobStatusNew captures enum value "new"
	JobStatusNew string = "new"

	// JobStatusQueued captures enum value "queued"
	JobStatusQueued string = "queued"
)

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

func (m *Job) validateStatus(formats strfmt.Registry) error {

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

	// value enum
	if err := m.validateStatusEnum("Status", "body", m.Status); err != nil {
		return err
	}

	return nil
}

var jobTypeTargetPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["api","fabric","taxnexus","telnexus"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		jobTypeTargetPropEnum = append(jobTypeTargetPropEnum, v)
	}
}

const (

	// JobTargetAPI captures enum value "api"
	JobTargetAPI string = "api"

	// JobTargetFabric captures enum value "fabric"
	JobTargetFabric string = "fabric"

	// JobTargetTaxnexus captures enum value "taxnexus"
	JobTargetTaxnexus string = "taxnexus"

	// JobTargetTelnexus captures enum value "telnexus"
	JobTargetTelnexus string = "telnexus"
)

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

func (m *Job) validateTarget(formats strfmt.Registry) error {

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

	// value enum
	if err := m.validateTargetEnum("Target", "body", m.Target); err != nil {
		return err
	}

	return nil
}

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

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