// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package shared

import (
	"encoding/json"
	"fmt"
)

// JobType - enum that describes the different types of jobs that the platform runs.
type JobType string

const (
	JobTypeGetSpec           JobType = "get_spec"
	JobTypeCheckConnection   JobType = "check_connection"
	JobTypeDiscoverSchema    JobType = "discover_schema"
	JobTypeSync              JobType = "sync"
	JobTypeResetConnection   JobType = "reset_connection"
	JobTypeConnectionUpdater JobType = "connection_updater"
	JobTypeReplicate         JobType = "replicate"
)

func (e JobType) ToPointer() *JobType {
	return &e
}
func (e *JobType) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "get_spec":
		fallthrough
	case "check_connection":
		fallthrough
	case "discover_schema":
		fallthrough
	case "sync":
		fallthrough
	case "reset_connection":
		fallthrough
	case "connection_updater":
		fallthrough
	case "replicate":
		*e = JobType(v)
		return nil
	default:
		return fmt.Errorf("invalid value for JobType: %v", v)
	}
}
