export interface ChecklistItem {
  id: string;
  text: string;
  done: boolean;
  subItems?: string[];
}

export interface ChecklistCategory {
  id: string;
  emoji: string;
  title: string;
  items: ChecklistItem[];
}

export interface ChecklistSection {
  id: string;
  title: string;
  categories: ChecklistCategory[];
}

let _counter = 0;
const uid = () => `item-${++_counter}`;

export function getDefaultComplianceTemplate(): ChecklistSection[] {
  _counter = 0;
  return [
    {
      id: "annual-compliance",
      title: "1. Annual Compliance Requirements",
      categories: [
        {
          id: "corporate-legal",
          emoji: "🏛️",
          title: "Corporate / Legal",
          items: [
            { id: uid(), text: "File Annual Report with Sunbiz (Due May 1)", done: false },
            { id: uid(), text: "Confirm registered agent + board members are accurate", done: false },
            { id: uid(), text: "Maintain corporate status (avoid administrative dissolution)", done: false },
          ],
        },
        {
          id: "financial-compliance",
          emoji: "💰",
          title: "Financial Compliance",
          items: [
            { id: uid(), text: "Close books at year-end", done: false },
            { id: uid(), text: "Prepare annual financial report (within 90 days)", done: false },
            { id: uid(), text: "Deliver financial report to owners (within 120–180 days)", done: false },
            { id: uid(), text: "Confirm correct report type (cash / compilation / review / audit)", done: false },
            { id: uid(), text: "File federal tax return (CPA)", done: false },
            { id: uid(), text: "Fund reserves (if applicable)", done: false },
          ],
        },
        {
          id: "budgeting",
          emoji: "📊",
          title: "Budgeting",
          items: [
            { id: uid(), text: "Prepare annual budget", done: false },
            { id: uid(), text: "Board approval of budget", done: false },
            { id: uid(), text: "Distribute budget OR notice of availability to owners", done: false },
            { id: uid(), text: "Confirm reserve contributions", done: false },
          ],
        },
        {
          id: "meetings-governance",
          emoji: "🗳️",
          title: "Meetings & Governance",
          items: [
            { id: uid(), text: "Schedule annual meeting", done: false },
            { id: uid(), text: "Send proper notice (per bylaws/statute)", done: false },
            { id: uid(), text: "Verify quorum requirements", done: false },
            { id: uid(), text: "Conduct election (if applicable)", done: false },
            { id: uid(), text: "Record minutes", done: false },
            { id: uid(), text: "Post/retain minutes", done: false },
          ],
        },
        {
          id: "recordkeeping",
          emoji: "📚",
          title: "Recordkeeping",
          items: [
            { id: uid(), text: "Maintain official records (7 years minimum)", done: false },
            { id: uid(), text: "Keep: Owner roster, Financials, Contracts, Violations, ARC applications", done: false },
            { id: uid(), text: "Respond to records requests within 10 business days", done: false },
          ],
        },
        {
          id: "website",
          emoji: "🌐",
          title: "Website (if 100+ parcels)",
          items: [
            { id: uid(), text: "Maintain website/portal", done: false },
            { id: uid(), text: "Upload: Governing documents, Financials, Budgets, Contracts, Meeting notices", done: false },
          ],
        },
        {
          id: "board-requirements",
          emoji: "🧑‍🏫",
          title: "Board Requirements",
          items: [
            { id: uid(), text: "New board members certified within 90 days", done: false },
            { id: uid(), text: "Track continuing education (if applicable)", done: false },
          ],
        },
        {
          id: "insurance",
          emoji: "🛡️",
          title: "Insurance",
          items: [
            { id: uid(), text: "Review policies annually", done: false },
            { id: uid(), text: "Renew before expiration", done: false },
            { id: uid(), text: "Verify coverage levels", done: false },
            { id: uid(), text: "Maintain COIs for vendors", done: false },
          ],
        },
        {
          id: "compliance-enforcement",
          emoji: "⚖️",
          title: "Compliance / Enforcement",
          items: [
            { id: uid(), text: "Send violation notices", done: false },
            { id: uid(), text: "Hold fining hearings (if needed)", done: false },
            { id: uid(), text: "Maintain fining committee", done: false },
            { id: uid(), text: "Track compliance", done: false },
          ],
        },
      ],
    },
    {
      id: "monthly-tracker",
      title: "2. Monthly Task Tracker",
      categories: [
        {
          id: "monthly-financial",
          emoji: "💵",
          title: "Financial (Every Month)",
          items: [
            { id: uid(), text: "Reconcile bank accounts", done: false },
            { id: uid(), text: "Review financial reports", done: false },
            { id: uid(), text: "Update owner ledgers", done: false },
            { id: uid(), text: "Deposit assessments", done: false },
            { id: uid(), text: "Pay vendors", done: false },
          ],
        },
        {
          id: "monthly-admin",
          emoji: "📋",
          title: "Administrative (Every Month)",
          items: [
            { id: uid(), text: "Update owner roster", done: false },
            { id: uid(), text: "Log violations & ARC requests", done: false },
            { id: uid(), text: "File invoices & receipts", done: false },
            { id: uid(), text: "Backup records", done: false },
          ],
        },
        {
          id: "monthly-communication",
          emoji: "📬",
          title: "Communication (Every Month)",
          items: [
            { id: uid(), text: "Send owner updates (if needed)", done: false },
            { id: uid(), text: "Respond to owner requests", done: false },
            { id: uid(), text: "Process estoppels", done: false },
          ],
        },
        {
          id: "monthly-compliance",
          emoji: "⚖️",
          title: "Compliance (Every Month)",
          items: [
            { id: uid(), text: "Drive community / inspections", done: false },
            { id: uid(), text: "Send violation letters", done: false },
            { id: uid(), text: "Track unresolved issues", done: false },
          ],
        },
        {
          id: "quarterly",
          emoji: "🧭",
          title: "Quarterly Tasks",
          items: [
            { id: uid(), text: "Review budget vs actuals", done: false },
            { id: uid(), text: "Review delinquencies & collections", done: false },
            { id: uid(), text: "Review contracts/vendors", done: false },
            { id: uid(), text: "Review reserve balances", done: false },
          ],
        },
      ],
    },
    {
      id: "annual-flow",
      title: "3. Annual Flow",
      categories: [
        {
          id: "q1",
          emoji: "📅",
          title: "Q1 (Jan–Mar)",
          items: [
            { id: uid(), text: "Close books", done: false },
            { id: uid(), text: "Start financial report", done: false },
            { id: uid(), text: "Begin tax prep", done: false },
            { id: uid(), text: "Insurance review", done: false },
          ],
        },
        {
          id: "q2",
          emoji: "📅",
          title: "Q2 (Apr–Jun)",
          items: [
            { id: uid(), text: "Finalize financial report", done: false },
            { id: uid(), text: "File Sunbiz (May 1)", done: false },
            { id: uid(), text: "Send financials to owners", done: false },
            { id: uid(), text: "Annual meeting prep", done: false },
          ],
        },
        {
          id: "q3",
          emoji: "📅",
          title: "Q3 (Jul–Sep)",
          items: [
            { id: uid(), text: "Hold annual meeting", done: false },
            { id: uid(), text: "Board organization", done: false },
            { id: uid(), text: "Vendor review", done: false },
            { id: uid(), text: "Start budget planning", done: false },
          ],
        },
        {
          id: "q4",
          emoji: "📅",
          title: "Q4 (Oct–Dec)",
          items: [
            { id: uid(), text: "Approve next year budget", done: false },
            { id: uid(), text: "Send budget notice", done: false },
            { id: uid(), text: "Year-end financial prep", done: false },
          ],
        },
      ],
    },
  ];
}
