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

package components

import (
	"encoding/json"
	"fmt"
)

type Status string

const (
	StatusInactive       Status = "inactive"
	StatusScheduled      Status = "scheduled"
	StatusInprogress     Status = "inprogress"
	StatusComplete       Status = "complete"
	StatusCancelled      Status = "cancelled"
	StatusError          Status = "error"
	StatusPostprocessing Status = "postprocessing"
	StatusPaused         Status = "paused"
)

func (e Status) ToPointer() *Status {
	return &e
}
func (e *Status) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "inactive":
		fallthrough
	case "scheduled":
		fallthrough
	case "inprogress":
		fallthrough
	case "complete":
		fallthrough
	case "cancelled":
		fallthrough
	case "error":
		fallthrough
	case "postprocessing":
		fallthrough
	case "paused":
		*e = Status(v)
		return nil
	default:
		return fmt.Errorf("invalid value for Status: %v", v)
	}
}

// MediaGrabOperation - A media grab opration represents a scheduled or active recording of media
type MediaGrabOperation struct {
	CurrentSize         *int64  `json:"currentSize,omitempty"`
	GrabberIdentifier   *string `json:"grabberIdentifier,omitempty"`
	GrabberProtocol     *string `json:"grabberProtocol,omitempty"`
	ID                  *string `json:"id,omitempty"`
	Key                 *string `json:"key,omitempty"`
	MediaIndex          *int64  `json:"mediaIndex,omitempty"`
	MediaSubscriptionID *int64  `json:"mediaSubscriptionID,omitempty"`
	// Items in a library are referred to as "metadata items." These metadata items are distinct from "media items" which represent actual instances of media that can be consumed. Consider a TV library that has a single video file in it for a particular episode of a show. The library has a single media item, but it has three metadata items: one for the show, one for the season, and one for the episode. Consider a movie library that has two video files in it: the same movie, but two different resolutions. The library has a single metadata item for the movie, but that metadata item has two media items, one for each resolution. Additionally a "media item" will have one or more "media parts" where the the parts are intended to be watched together, such as a CD1 and CD2 parts of the same movie.
	//
	// Note that when a metadata item has multiple media items, those media items should be isomorphic. That is, a 4K version and 1080p version of a movie are different versions of the same movie. They have the same duration, same summary, same rating, etc. and they can generally be considered interchangeable. A theatrical release vs. director's cut vs. unrated version on the other hand would be separate metadata items.
	//
	// Metadata items can often live in a hierarchy with relationships between them.  For example, the metadata item for an episodes is associated with a season metadata item which is associated with a show metadata item.  A similar hierarchy exists with track, album, and artist and photos and photo album.  The relationships may be expressed via relative terms and absolute terms.  For example, "leaves" refer to metadata items which has associated media (there is no media for a season nor show).  A show will have "children" in the form of seasons and a season will have "children" in the form of episodes and episodes have "parent" in the form of a season which has a "parent" in the form of a show.  Similarly, a show has "grandchildren" in the form of episodse and an episode has a "grandparent" in the form of a show.
	//
	Metadata *Metadata `json:"Metadata,omitempty"`
	Percent  *float64  `json:"percent,omitempty"`
	Provider *string   `json:"provider,omitempty"`
	Status   *Status   `json:"status,omitempty"`
}

func (m *MediaGrabOperation) GetCurrentSize() *int64 {
	if m == nil {
		return nil
	}
	return m.CurrentSize
}

func (m *MediaGrabOperation) GetGrabberIdentifier() *string {
	if m == nil {
		return nil
	}
	return m.GrabberIdentifier
}

func (m *MediaGrabOperation) GetGrabberProtocol() *string {
	if m == nil {
		return nil
	}
	return m.GrabberProtocol
}

func (m *MediaGrabOperation) GetID() *string {
	if m == nil {
		return nil
	}
	return m.ID
}

func (m *MediaGrabOperation) GetKey() *string {
	if m == nil {
		return nil
	}
	return m.Key
}

func (m *MediaGrabOperation) GetMediaIndex() *int64 {
	if m == nil {
		return nil
	}
	return m.MediaIndex
}

func (m *MediaGrabOperation) GetMediaSubscriptionID() *int64 {
	if m == nil {
		return nil
	}
	return m.MediaSubscriptionID
}

func (m *MediaGrabOperation) GetMetadata() *Metadata {
	if m == nil {
		return nil
	}
	return m.Metadata
}

func (m *MediaGrabOperation) GetPercent() *float64 {
	if m == nil {
		return nil
	}
	return m.Percent
}

func (m *MediaGrabOperation) GetProvider() *string {
	if m == nil {
		return nil
	}
	return m.Provider
}

func (m *MediaGrabOperation) GetStatus() *Status {
	if m == nil {
		return nil
	}
	return m.Status
}
