import { Text, Section } from "@react-email/components";
import { EmailLayout } from "./layout";

interface Props {
  po: { poNumber: string; title: string };
  note: string;
}

export function PoRejectedEmail({ po, note }: Props) {
  return (
    <EmailLayout>
      <Text style={{ fontSize: "16px", color: "#111827", marginTop: 0 }}>
        Your purchase order has been{" "}
        <span style={{ color: "#dc2626", fontWeight: "600" }}>rejected</span>.
      </Text>
      <Section style={{ backgroundColor: "#fef2f2", borderRadius: "8px", padding: "16px", border: "1px solid #fee2e2" }}>
        <Text style={{ margin: "0 0 4px", fontSize: "13px", color: "#6b7280" }}>PO Number</Text>
        <Text style={{ margin: "0 0 12px", fontWeight: "600", fontFamily: "monospace" }}>{po.poNumber}</Text>
        <Text style={{ margin: "0 0 4px", fontSize: "13px", color: "#6b7280" }}>Title</Text>
        <Text style={{ margin: 0 }}>{po.title}</Text>
      </Section>
      <Section style={{ marginTop: "16px", borderLeft: "3px solid #dc2626", paddingLeft: "12px" }}>
        <Text style={{ margin: "0 0 4px", fontSize: "13px", color: "#6b7280" }}>Reason</Text>
        <Text style={{ margin: 0, fontSize: "14px", color: "#374151" }}>{note}</Text>
      </Section>
      <Text style={{ fontSize: "14px", color: "#374151" }}>
        If you have questions, please contact your manager directly.
      </Text>
    </EmailLayout>
  );
}

export default PoRejectedEmail;
