import { z } from "zod";

/** Metadata about the source filing. */
export const FilingMeta = z.object({
  companyName: z.string(),
  cik: z.string(),
  ticker: z.string(),
  filingType: z.enum(["10-K", "8-K"]),
  filingDate: z.iso.date(),
  fiscalYear: z.number().int(),
  accessionNumber: z.string(),
  secItem: z.string(), // "Item 1C", "Item 1.05", "Item 8.01", etc.
});
export type FilingMeta = z.infer<typeof FilingMeta>;

/** A single paragraph extracted from an SEC filing, ready for labeling. */
export const Paragraph = z.object({
  id: z.uuid(),
  text: z.string(),
  textHash: z.string(), // SHA-256 of normalized text — for dedup and cross-filing tracking
  wordCount: z.number().int(),
  paragraphIndex: z.number().int(), // position within the filing section
  filing: FilingMeta,
});
export type Paragraph = z.infer<typeof Paragraph>;
