// TicketProjectArtifacts - Component for displaying project metadata and artifacts
import React from 'react';

function TicketProjectArtifacts({ ticket }) {
  if (!ticket) return null;

  return (
    <div className="grid grid-cols-1 md:grid-cols-2 gap-3 text-sm">
      <div className="rounded-lg border border-gray-200 bg-white p-3">
        <div className="text-xs font-medium text-gray-500 mb-2">Project metadata</div>
        <div className="space-y-1 text-xs text-gray-600">
          <div><span className="font-medium text-gray-500">Project:</span> {ticket.project_id || "—"}</div>
          <div><span className="font-medium text-gray-500">Sprint:</span> {ticket.sprint_id || "—"}</div>
          <div><span className="font-medium text-gray-500">Priority:</span> {ticket.priority}</div>
          <div><span className="font-medium text-gray-500">Type:</span> {ticket.type}</div>
          <div><span className="font-medium text-gray-500">Created:</span> {formatTimestamp(ticket.created_at)}</div>
          <div><span className="font-medium text-gray-500">Updated:</span> {formatTimestamp(ticket.updated_at)}</div>
        </div>
      </div>

      <div className="rounded-lg border border-gray-200 bg-white p-3">
        <div className="text-xs font-medium text-gray-500 mb-2">Artifacts</div>
        <div className="space-y-2 text-xs text-gray-600">
          <div><span className="font-medium text-gray-500">Tags:</span> {ticket.tags?.length ? ticket.tags.join(", ") : "—"}</div>
          <div><span className="font-medium text-gray-500">Files:</span> {ticket.files?.length ? ticket.files.join(", ") : "—"}</div>
          <div><span className="font-medium text-gray-500">Estimated hours:</span> {ticket.estimated_hours || "—"}</div>
          <div><span className="font-medium text-gray-500">Actual hours:</span> {ticket.actual_hours || "—"}</div>
        </div>
      </div>
    </div>
  );
}

export default TicketProjectArtifacts;
