import { View, Text, StyleSheet } from "@react-pdf/renderer";
import { C, PAGE_H_PAD, PAGE_V_PAD, FOOTER_H } from "../styles";

const s = StyleSheet.create({
  footer: {
    position: "absolute",
    bottom: PAGE_V_PAD - FOOTER_H,
    left: PAGE_H_PAD,
    right: PAGE_H_PAD,
    height: FOOTER_H,
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "space-between",
    borderTopWidth: 0.75,
    borderTopColor: C.border,
    paddingTop: 6,
  },
  left: { fontSize: 8, fontFamily: "Helvetica-Bold", color: C.accent, letterSpacing: -0.2 },
  center: { fontSize: 8, color: C.caption },
  right: { fontSize: 8, color: C.muted },
});

const FOOTER_3RD =
  "Powered by the meSEO Behavioral Intelligence Scraper. Analysis derived from publicly observable signals across the domain. For deeper insight including AI referral attribution and behavioral telemetry, install the meSEO Site Tag.";
const FOOTER_1ST =
  "Powered by the meSEO Behavioral Intelligence platform. Analysis combines first-party behavioral telemetry with structural site signals.";

export function PageFooter({ isFirstParty }: { isFirstParty: boolean }) {
  return (
    <View fixed style={s.footer}>
      <Text style={s.left}>meSEO</Text>
      <Text style={s.center}>{isFirstParty ? FOOTER_1ST : FOOTER_3RD}</Text>
      <Text
        style={s.right}
        render={({ pageNumber, totalPages }: { pageNumber: number; totalPages: number }) =>
          `Page ${pageNumber} of ${totalPages}`
        }
      />
    </View>
  );
}
