import { Link } from "react-router-dom";
import { getUrlForSearchResult, type SearchResult } from "../../../Lib/Search";
import type { Server } from "../../../Lib/Servers";

interface ServerSearchResultProps {
  searchResult: SearchResult;
  server: Server;
}

const ServerSearchResult = ({ searchResult, server }: ServerSearchResultProps) => {
  const resultUrl = getUrlForSearchResult(searchResult, server);

  return (
    <Link to={resultUrl} target="_blank" rel="noopener noreferrer">
      <h3>{searchResult.name} - {searchResult.productionYear}</h3>
    </Link>
  )
}

export default ServerSearchResult;