-- name: ListFilms :many
SELECT film_id,
       title,
       description,
       release_year,
       language_id,
       original_language_id,
       rental_duration,
       rental_rate,
       length,
       replacement_cost,
       rating,
       special_features,
       last_update
FROM film
ORDER BY film_id ASC
LIMIT ? OFFSET ?;

-- name: CountFilms :one
SELECT COUNT(*)
FROM film;

-- name: GetFilm :one
SELECT film_id,
       title,
       description,
       release_year,
       language_id,
       original_language_id,
       rental_duration,
       rental_rate,
       length,
       replacement_cost,
       rating,
       special_features,
       last_update
FROM film
WHERE film_id = ?;

-- name: ListActorsByFilm :many
SELECT a.actor_id, a.first_name, a.last_name, a.last_update
FROM actor a
         JOIN film_actor fa ON fa.actor_id = a.actor_id
WHERE fa.film_id = ?
ORDER BY a.last_name ASC, a.first_name ASC;