import { Card } from "@components/Card.tsx";
import { Movie } from "@lib/movies.ts";

export function MovieCard({ movie }: { movie: Movie }) {
  const { meta: { image = "/placeholder.svg" } = {} } = movie;

  const imageUrl = image?.startsWith("Media/movies/")
    ? `/api/images?image=${image}&width=200&height=200`
    : image;

  return (
    <Card
      title={movie.name}
      image={imageUrl}
      link={`/movies/${movie.id}`}
    />
  );
}
