// Code generated by sqlc. DO NOT EDIT.
// source: queries.sql

package store

import (
	"context"
	"database/sql"

	"github.com/google/uuid"
)

const createMediaSet = `-- name: CreateMediaSet :one
INSERT INTO media_sets (youtube_id, title, description, author, audio_youtube_itag, audio_channels, audio_frames_approx, audio_sample_rate, audio_content_length, audio_encoded_mime_type, video_youtube_itag, video_content_length, video_mime_type, video_duration_nanos, created_at, updated_at)
  VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, NOW(), NOW())
  RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_key, audio_encoded_s3_uploaded_at, title, description, author
`

type CreateMediaSetParams struct {
	YoutubeID            string
	Title                string
	Description          string
	Author               string
	AudioYoutubeItag     int32
	AudioChannels        int32
	AudioFramesApprox    int64
	AudioSampleRate      int32
	AudioContentLength   int64
	AudioEncodedMimeType string
	VideoYoutubeItag     int32
	VideoContentLength   int64
	VideoMimeType        string
	VideoDurationNanos   int64
}

func (q *Queries) CreateMediaSet(ctx context.Context, arg CreateMediaSetParams) (MediaSet, error) {
	row := q.db.QueryRow(ctx, createMediaSet,
		arg.YoutubeID,
		arg.Title,
		arg.Description,
		arg.Author,
		arg.AudioYoutubeItag,
		arg.AudioChannels,
		arg.AudioFramesApprox,
		arg.AudioSampleRate,
		arg.AudioContentLength,
		arg.AudioEncodedMimeType,
		arg.VideoYoutubeItag,
		arg.VideoContentLength,
		arg.VideoMimeType,
		arg.VideoDurationNanos,
	)
	var i MediaSet
	err := row.Scan(
		&i.ID,
		&i.YoutubeID,
		&i.AudioYoutubeItag,
		&i.AudioChannels,
		&i.AudioFramesApprox,
		&i.AudioFrames,
		&i.AudioSampleRate,
		&i.AudioRawS3Key,
		&i.AudioRawS3UploadedAt,
		&i.AudioEncodedMimeType,
		&i.VideoYoutubeItag,
		&i.VideoS3Key,
		&i.VideoS3UploadedAt,
		&i.VideoMimeType,
		&i.VideoDurationNanos,
		&i.VideoThumbnailS3Key,
		&i.VideoThumbnailS3UploadedAt,
		&i.VideoThumbnailMimeType,
		&i.VideoThumbnailWidth,
		&i.VideoThumbnailHeight,
		&i.CreatedAt,
		&i.UpdatedAt,
		&i.AudioContentLength,
		&i.VideoContentLength,
		&i.AudioEncodedS3Key,
		&i.AudioEncodedS3UploadedAt,
		&i.Title,
		&i.Description,
		&i.Author,
	)
	return i, err
}

const getMediaSet = `-- name: GetMediaSet :one
SELECT id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_key, audio_encoded_s3_uploaded_at, title, description, author FROM media_sets WHERE id = $1
`

func (q *Queries) GetMediaSet(ctx context.Context, id uuid.UUID) (MediaSet, error) {
	row := q.db.QueryRow(ctx, getMediaSet, id)
	var i MediaSet
	err := row.Scan(
		&i.ID,
		&i.YoutubeID,
		&i.AudioYoutubeItag,
		&i.AudioChannels,
		&i.AudioFramesApprox,
		&i.AudioFrames,
		&i.AudioSampleRate,
		&i.AudioRawS3Key,
		&i.AudioRawS3UploadedAt,
		&i.AudioEncodedMimeType,
		&i.VideoYoutubeItag,
		&i.VideoS3Key,
		&i.VideoS3UploadedAt,
		&i.VideoMimeType,
		&i.VideoDurationNanos,
		&i.VideoThumbnailS3Key,
		&i.VideoThumbnailS3UploadedAt,
		&i.VideoThumbnailMimeType,
		&i.VideoThumbnailWidth,
		&i.VideoThumbnailHeight,
		&i.CreatedAt,
		&i.UpdatedAt,
		&i.AudioContentLength,
		&i.VideoContentLength,
		&i.AudioEncodedS3Key,
		&i.AudioEncodedS3UploadedAt,
		&i.Title,
		&i.Description,
		&i.Author,
	)
	return i, err
}

const getMediaSetByYoutubeID = `-- name: GetMediaSetByYoutubeID :one
SELECT id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_key, audio_encoded_s3_uploaded_at, title, description, author FROM media_sets WHERE youtube_id = $1
`

func (q *Queries) GetMediaSetByYoutubeID(ctx context.Context, youtubeID string) (MediaSet, error) {
	row := q.db.QueryRow(ctx, getMediaSetByYoutubeID, youtubeID)
	var i MediaSet
	err := row.Scan(
		&i.ID,
		&i.YoutubeID,
		&i.AudioYoutubeItag,
		&i.AudioChannels,
		&i.AudioFramesApprox,
		&i.AudioFrames,
		&i.AudioSampleRate,
		&i.AudioRawS3Key,
		&i.AudioRawS3UploadedAt,
		&i.AudioEncodedMimeType,
		&i.VideoYoutubeItag,
		&i.VideoS3Key,
		&i.VideoS3UploadedAt,
		&i.VideoMimeType,
		&i.VideoDurationNanos,
		&i.VideoThumbnailS3Key,
		&i.VideoThumbnailS3UploadedAt,
		&i.VideoThumbnailMimeType,
		&i.VideoThumbnailWidth,
		&i.VideoThumbnailHeight,
		&i.CreatedAt,
		&i.UpdatedAt,
		&i.AudioContentLength,
		&i.VideoContentLength,
		&i.AudioEncodedS3Key,
		&i.AudioEncodedS3UploadedAt,
		&i.Title,
		&i.Description,
		&i.Author,
	)
	return i, err
}

const setEncodedAudioUploaded = `-- name: SetEncodedAudioUploaded :one
UPDATE media_sets
  SET audio_encoded_s3_key = $2, audio_encoded_s3_uploaded_at = NOW(), updated_at = NOW()
  WHERE id = $1
  RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_key, audio_encoded_s3_uploaded_at, title, description, author
`

type SetEncodedAudioUploadedParams struct {
	ID                uuid.UUID
	AudioEncodedS3Key sql.NullString
}

func (q *Queries) SetEncodedAudioUploaded(ctx context.Context, arg SetEncodedAudioUploadedParams) (MediaSet, error) {
	row := q.db.QueryRow(ctx, setEncodedAudioUploaded, arg.ID, arg.AudioEncodedS3Key)
	var i MediaSet
	err := row.Scan(
		&i.ID,
		&i.YoutubeID,
		&i.AudioYoutubeItag,
		&i.AudioChannels,
		&i.AudioFramesApprox,
		&i.AudioFrames,
		&i.AudioSampleRate,
		&i.AudioRawS3Key,
		&i.AudioRawS3UploadedAt,
		&i.AudioEncodedMimeType,
		&i.VideoYoutubeItag,
		&i.VideoS3Key,
		&i.VideoS3UploadedAt,
		&i.VideoMimeType,
		&i.VideoDurationNanos,
		&i.VideoThumbnailS3Key,
		&i.VideoThumbnailS3UploadedAt,
		&i.VideoThumbnailMimeType,
		&i.VideoThumbnailWidth,
		&i.VideoThumbnailHeight,
		&i.CreatedAt,
		&i.UpdatedAt,
		&i.AudioContentLength,
		&i.VideoContentLength,
		&i.AudioEncodedS3Key,
		&i.AudioEncodedS3UploadedAt,
		&i.Title,
		&i.Description,
		&i.Author,
	)
	return i, err
}

const setRawAudioUploaded = `-- name: SetRawAudioUploaded :one
UPDATE media_sets
  SET audio_raw_s3_key = $2, audio_frames = $3, audio_raw_s3_uploaded_at = NOW(), updated_at = NOW()
  WHERE id = $1
  RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_key, audio_encoded_s3_uploaded_at, title, description, author
`

type SetRawAudioUploadedParams struct {
	ID            uuid.UUID
	AudioRawS3Key sql.NullString
	AudioFrames   sql.NullInt64
}

func (q *Queries) SetRawAudioUploaded(ctx context.Context, arg SetRawAudioUploadedParams) (MediaSet, error) {
	row := q.db.QueryRow(ctx, setRawAudioUploaded, arg.ID, arg.AudioRawS3Key, arg.AudioFrames)
	var i MediaSet
	err := row.Scan(
		&i.ID,
		&i.YoutubeID,
		&i.AudioYoutubeItag,
		&i.AudioChannels,
		&i.AudioFramesApprox,
		&i.AudioFrames,
		&i.AudioSampleRate,
		&i.AudioRawS3Key,
		&i.AudioRawS3UploadedAt,
		&i.AudioEncodedMimeType,
		&i.VideoYoutubeItag,
		&i.VideoS3Key,
		&i.VideoS3UploadedAt,
		&i.VideoMimeType,
		&i.VideoDurationNanos,
		&i.VideoThumbnailS3Key,
		&i.VideoThumbnailS3UploadedAt,
		&i.VideoThumbnailMimeType,
		&i.VideoThumbnailWidth,
		&i.VideoThumbnailHeight,
		&i.CreatedAt,
		&i.UpdatedAt,
		&i.AudioContentLength,
		&i.VideoContentLength,
		&i.AudioEncodedS3Key,
		&i.AudioEncodedS3UploadedAt,
		&i.Title,
		&i.Description,
		&i.Author,
	)
	return i, err
}

const setVideoThumbnailUploaded = `-- name: SetVideoThumbnailUploaded :one
UPDATE media_sets
SET video_thumbnail_width = $2, video_thumbnail_height = $3, video_thumbnail_mime_type = $4, video_thumbnail_s3_key = $5, video_thumbnail_s3_uploaded_at = NOW(), updated_at = NOW()
WHERE id = $1
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_key, audio_encoded_s3_uploaded_at, title, description, author
`

type SetVideoThumbnailUploadedParams struct {
	ID                     uuid.UUID
	VideoThumbnailWidth    sql.NullInt32
	VideoThumbnailHeight   sql.NullInt32
	VideoThumbnailMimeType sql.NullString
	VideoThumbnailS3Key    sql.NullString
}

func (q *Queries) SetVideoThumbnailUploaded(ctx context.Context, arg SetVideoThumbnailUploadedParams) (MediaSet, error) {
	row := q.db.QueryRow(ctx, setVideoThumbnailUploaded,
		arg.ID,
		arg.VideoThumbnailWidth,
		arg.VideoThumbnailHeight,
		arg.VideoThumbnailMimeType,
		arg.VideoThumbnailS3Key,
	)
	var i MediaSet
	err := row.Scan(
		&i.ID,
		&i.YoutubeID,
		&i.AudioYoutubeItag,
		&i.AudioChannels,
		&i.AudioFramesApprox,
		&i.AudioFrames,
		&i.AudioSampleRate,
		&i.AudioRawS3Key,
		&i.AudioRawS3UploadedAt,
		&i.AudioEncodedMimeType,
		&i.VideoYoutubeItag,
		&i.VideoS3Key,
		&i.VideoS3UploadedAt,
		&i.VideoMimeType,
		&i.VideoDurationNanos,
		&i.VideoThumbnailS3Key,
		&i.VideoThumbnailS3UploadedAt,
		&i.VideoThumbnailMimeType,
		&i.VideoThumbnailWidth,
		&i.VideoThumbnailHeight,
		&i.CreatedAt,
		&i.UpdatedAt,
		&i.AudioContentLength,
		&i.VideoContentLength,
		&i.AudioEncodedS3Key,
		&i.AudioEncodedS3UploadedAt,
		&i.Title,
		&i.Description,
		&i.Author,
	)
	return i, err
}

const setVideoUploaded = `-- name: SetVideoUploaded :one
UPDATE media_sets
  SET video_s3_key = $2, video_s3_uploaded_at = NOW(), updated_at = NOW()
  WHERE id = $1
  RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_key, audio_encoded_s3_uploaded_at, title, description, author
`

type SetVideoUploadedParams struct {
	ID         uuid.UUID
	VideoS3Key sql.NullString
}

func (q *Queries) SetVideoUploaded(ctx context.Context, arg SetVideoUploadedParams) (MediaSet, error) {
	row := q.db.QueryRow(ctx, setVideoUploaded, arg.ID, arg.VideoS3Key)
	var i MediaSet
	err := row.Scan(
		&i.ID,
		&i.YoutubeID,
		&i.AudioYoutubeItag,
		&i.AudioChannels,
		&i.AudioFramesApprox,
		&i.AudioFrames,
		&i.AudioSampleRate,
		&i.AudioRawS3Key,
		&i.AudioRawS3UploadedAt,
		&i.AudioEncodedMimeType,
		&i.VideoYoutubeItag,
		&i.VideoS3Key,
		&i.VideoS3UploadedAt,
		&i.VideoMimeType,
		&i.VideoDurationNanos,
		&i.VideoThumbnailS3Key,
		&i.VideoThumbnailS3UploadedAt,
		&i.VideoThumbnailMimeType,
		&i.VideoThumbnailWidth,
		&i.VideoThumbnailHeight,
		&i.CreatedAt,
		&i.UpdatedAt,
		&i.AudioContentLength,
		&i.VideoContentLength,
		&i.AudioEncodedS3Key,
		&i.AudioEncodedS3UploadedAt,
		&i.Title,
		&i.Description,
		&i.Author,
	)
	return i, err
}
