// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.31.1
// source: lidarr_config.sql

package dbq

import (
	"context"

	"github.com/jackc/pgx/v5/pgtype"
)

const getLidarrConfig = `-- name: GetLidarrConfig :one
SELECT id, enabled, base_url, api_key, default_quality_profile_id,
       default_metadata_profile_id, default_root_folder_path,
       created_at, updated_at
FROM lidarr_config
WHERE id = 1
`

type GetLidarrConfigRow struct {
	ID                       int16
	Enabled                  bool
	BaseUrl                  *string
	ApiKey                   *string
	DefaultQualityProfileID  *int32
	DefaultMetadataProfileID *int32
	DefaultRootFolderPath    *string
	CreatedAt                pgtype.Timestamptz
	UpdatedAt                pgtype.Timestamptz
}

func (q *Queries) GetLidarrConfig(ctx context.Context) (GetLidarrConfigRow, error) {
	row := q.db.QueryRow(ctx, getLidarrConfig)
	var i GetLidarrConfigRow
	err := row.Scan(
		&i.ID,
		&i.Enabled,
		&i.BaseUrl,
		&i.ApiKey,
		&i.DefaultQualityProfileID,
		&i.DefaultMetadataProfileID,
		&i.DefaultRootFolderPath,
		&i.CreatedAt,
		&i.UpdatedAt,
	)
	return i, err
}

const updateLidarrConfig = `-- name: UpdateLidarrConfig :one
UPDATE lidarr_config
   SET enabled                     = $1,
       base_url                    = $2,
       api_key                     = $3,
       default_quality_profile_id  = $4,
       default_metadata_profile_id = $5,
       default_root_folder_path    = $6,
       updated_at                  = now()
 WHERE id = 1
 RETURNING id, enabled, base_url, api_key, default_quality_profile_id,
           default_metadata_profile_id, default_root_folder_path,
           created_at, updated_at
`

type UpdateLidarrConfigParams struct {
	Enabled                  bool
	BaseUrl                  *string
	ApiKey                   *string
	DefaultQualityProfileID  *int32
	DefaultMetadataProfileID *int32
	DefaultRootFolderPath    *string
}

type UpdateLidarrConfigRow struct {
	ID                       int16
	Enabled                  bool
	BaseUrl                  *string
	ApiKey                   *string
	DefaultQualityProfileID  *int32
	DefaultMetadataProfileID *int32
	DefaultRootFolderPath    *string
	CreatedAt                pgtype.Timestamptz
	UpdatedAt                pgtype.Timestamptz
}

func (q *Queries) UpdateLidarrConfig(ctx context.Context, arg UpdateLidarrConfigParams) (UpdateLidarrConfigRow, error) {
	row := q.db.QueryRow(ctx, updateLidarrConfig,
		arg.Enabled,
		arg.BaseUrl,
		arg.ApiKey,
		arg.DefaultQualityProfileID,
		arg.DefaultMetadataProfileID,
		arg.DefaultRootFolderPath,
	)
	var i UpdateLidarrConfigRow
	err := row.Scan(
		&i.ID,
		&i.Enabled,
		&i.BaseUrl,
		&i.ApiKey,
		&i.DefaultQualityProfileID,
		&i.DefaultMetadataProfileID,
		&i.DefaultRootFolderPath,
		&i.CreatedAt,
		&i.UpdatedAt,
	)
	return i, err
}
