import Link from 'next/link'
import { Card } from '@/libs/frontend-ui-primitives'

export const CONTRACT_VERIFICATION_GUIDE_URL =
  'https://gitea.d-bis.org/d-bis/proxmox/src/branch/master/docs/08-monitoring/BLOCKSCOUT_VERIFICATION_GUIDE.md'

export const FORGE_VERIFY_COMMAND =
  'source scripts/lib/load-project-env.sh && ./scripts/verify/run-contract-verification-with-proxy.sh'

interface ContractVerificationCalloutProps {
  address: string
  verified: boolean
}

export default function ContractVerificationCallout({ address, verified }: ContractVerificationCalloutProps) {
  if (verified) {
    return null
  }

  return (
    <Card title="Verify & Publish Contract" className="mb-6">
      <p className="text-sm leading-6 text-gray-600 dark:text-gray-400">
        This contract is not verified on the public explorer yet. Verified source improves read/write tooling,
        ABI decoding, and auditability for{' '}
        <span className="font-mono text-xs">{address}</span>.
      </p>
      <ul className="mt-4 list-disc space-y-2 pl-5 text-sm text-gray-700 dark:text-gray-300">
        <li>
          <strong>Forge batch (recommended):</strong>{' '}
          <code className="rounded bg-gray-100 px-1.5 py-0.5 text-xs dark:bg-gray-900">{FORGE_VERIFY_COMMAND}</code>
        </li>
        <li>
          <strong>Operator guide:</strong>{' '}
          <Link href={CONTRACT_VERIFICATION_GUIDE_URL} className="text-primary-600 hover:underline" target="_blank" rel="noopener noreferrer">
            Blockscout verification guide
          </Link>
        </li>
        <li>
          <strong>Native Blockscout UI (LAN):</strong> use contract verification on the VM Blockscout instance when the custom explorer UI does not expose the form.
        </li>
      </ul>
    </Card>
  )
}
