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

package db

import (
	"context"

	"github.com/google/uuid"
)

const createLabelColor = `-- name: CreateLabelColor :one
INSERT INTO label_color (name, color_hex, position) VALUES ($1, $2, $3)
  RETURNING label_color_id, color_hex, position, name
`

type CreateLabelColorParams struct {
	Name     string  `json:"name"`
	ColorHex string  `json:"color_hex"`
	Position float64 `json:"position"`
}

func (q *Queries) CreateLabelColor(ctx context.Context, arg CreateLabelColorParams) (LabelColor, error) {
	row := q.db.QueryRowContext(ctx, createLabelColor, arg.Name, arg.ColorHex, arg.Position)
	var i LabelColor
	err := row.Scan(
		&i.LabelColorID,
		&i.ColorHex,
		&i.Position,
		&i.Name,
	)
	return i, err
}

const getLabelColorByID = `-- name: GetLabelColorByID :one
SELECT label_color_id, color_hex, position, name FROM label_color WHERE label_color_id = $1
`

func (q *Queries) GetLabelColorByID(ctx context.Context, labelColorID uuid.UUID) (LabelColor, error) {
	row := q.db.QueryRowContext(ctx, getLabelColorByID, labelColorID)
	var i LabelColor
	err := row.Scan(
		&i.LabelColorID,
		&i.ColorHex,
		&i.Position,
		&i.Name,
	)
	return i, err
}

const getLabelColors = `-- name: GetLabelColors :many
SELECT label_color_id, color_hex, position, name FROM label_color
`

func (q *Queries) GetLabelColors(ctx context.Context) ([]LabelColor, error) {
	rows, err := q.db.QueryContext(ctx, getLabelColors)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []LabelColor
	for rows.Next() {
		var i LabelColor
		if err := rows.Scan(
			&i.LabelColorID,
			&i.ColorHex,
			&i.Position,
			&i.Name,
		); err != nil {
			return nil, err
		}
		items = append(items, i)
	}
	if err := rows.Close(); err != nil {
		return nil, err
	}
	if err := rows.Err(); err != nil {
		return nil, err
	}
	return items, nil
}