Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

44.1 KB
Raw Blame
import type {
  PollClosedReason,
  PollStatus,
  ScheduledEventInviteStatus,
  ScheduledEventStatus,
  SpaceMemberRole,
  SpaceTier,
  SubscriptionInterval,
  SubscriptionStatus,
  VoteType,
} from "../../generated/prisma/client";

// Returns an ISO string N days from midnight UTC today, with optional hour/minute.
function d(offsetDays: number, hour = 0, minute = 0): string {
  const base = new Date();
  base.setUTCHours(0, 0, 0, 0);
  base.setUTCDate(base.getUTCDate() + offsetDays);
  base.setUTCHours(hour, minute, 0, 0);
  return base.toISOString();
}

// ─── Users ───────────────────────────────────────────────────────────────────

export const users = [
  {
    id: "user-1",
    name: "Dev User",
    email: "[email protected]",
    timeZone: "America/New_York",
    weekStart: 1,
  },
  {
    id: "user-2",
    name: "Sarah Chen",
    email: "[email protected]",
    timeZone: "America/Los_Angeles",
  },
  {
    id: "user-3",
    name: "Michael Torres",
    email: "[email protected]",
    timeZone: "Europe/London",
  },
  {
    id: "user-4",
    name: "Emily Nakamura",
    email: "[email protected]",
    timeZone: "Asia/Tokyo",
  },
  {
    id: "user-5",
    name: "James Okonkwo",
    email: "[email protected]",
    timeZone: "America/Chicago",
  },
] as const;

// ─── Spaces ──────────────────────────────────────────────────────────────────

export const spaces: Array<{
  id: string;
  name: string;
  ownerId: string;
  tier: SpaceTier;
}> = [
  { id: "space-1", name: "Personal", ownerId: "user-1", tier: "hobby" },
  { id: "space-2", name: "Acme Inc", ownerId: "user-1", tier: "pro" },
];

export const spaceMembers: Array<{
  id: string;
  spaceId: string;
  userId: string;
  role: SpaceMemberRole;
}> = [
  { id: "sm-1", spaceId: "space-1", userId: "user-1", role: "ADMIN" },
  { id: "sm-2", spaceId: "space-2", userId: "user-1", role: "ADMIN" },
  { id: "sm-3", spaceId: "space-2", userId: "user-2", role: "ADMIN" },
  { id: "sm-4", spaceId: "space-2", userId: "user-3", role: "MEMBER" },
  { id: "sm-5", spaceId: "space-2", userId: "user-4", role: "MEMBER" },
  { id: "sm-6", spaceId: "space-2", userId: "user-5", role: "MEMBER" },
];

// ─── Subscriptions ───────────────────────────────────────────────────────────
// Every pro space needs one so billing settings reflect a real subscription.
// `amount` is the per-seat unit amount in the currency's minor unit.

export const subscriptions: Array<{
  id: string;
  spaceId: string;
  userId: string;
  priceId: string;
  subscriptionItemId: string;
  quantity: number;
  amount: number;
  currency: string;
  interval: SubscriptionInterval;
  status: SubscriptionStatus;
  active: boolean;
  cancelAtPeriodEnd: boolean;
  periodStart: string;
  periodEnd: string;
}> = [
  {
    id: "sub-1",
    spaceId: "space-2",
    userId: "user-1",
    priceId: "price_seed_pro_monthly",
    subscriptionItemId: "si_seed_pro_monthly",
    quantity: 6,
    amount: 700,
    currency: "usd",
    interval: "month",
    status: "active",
    active: true,
    cancelAtPeriodEnd: false,
    periodStart: d(-14),
    periodEnd: d(16),
  },
];

// ─── Poll definitions ────────────────────────────────────────────────────────
// Each participant's `votes` array maps 1:1 with the `options` array.

export type PollDef = {
  title: string;
  description?: string;
  location?: string;
  status: PollStatus;
  closedReason?: PollClosedReason;
  timeZone?: string;
  deadline?: string;
  userId: string;
  spaceId: string;
  scheduledEventId?: string;
  hideParticipants?: boolean;
  hideScores?: boolean;
  disableComments?: boolean;
  requireParticipantEmail?: boolean;
  options: Array<{ startTime: string; duration: number }>;
  participants: Array<{
    name: string;
    email?: string;
    userId?: string;
    note?: string;
    votes: VoteType[];
  }>;
  comments?: Array<{
    content: string;
    authorName: string;
    userId?: string;
  }>;
};

// ── Personal space polls ─────────────────────────────────────────────────────

const personalPolls: PollDef[] = [
  {
    title: "Coffee chat with Alex",
    description:
      "Quick catch-up over coffee. Any of these times work for the café on 5th.",
    location: "Café on 5th Ave",
    status: "open",
    timeZone: "America/New_York",
    userId: "user-1",
    spaceId: "space-1",
    options: [
      { startTime: d(7, 10), duration: 60 },
      { startTime: d(8, 14), duration: 60 },
      { startTime: d(9, 10), duration: 60 },
    ],
    participants: [
      {
        name: "Alex Rivera",
        email: "[email protected]",
        note: "Mornings work best for me, my afternoons are usually packed.",
        votes: ["yes", "no", "yes"],
      },
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "ifNeedBe"],
      },
    ],
  },
  {
    title: "Dentist appointment",
    description: "Need to book my six-month check-up.",
    status: "open",
    userId: "user-1",
    spaceId: "space-1",
    options: [
      { startTime: d(14), duration: 0 },
      { startTime: d(15), duration: 0 },
      { startTime: d(16), duration: 0 },
      { startTime: d(17), duration: 0 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "no", "yes"],
      },
    ],
  },
  {
    title: "Weekend hike",
    description:
      "Planning a group hike at Bear Mountain. Bring water and sunscreen!",
    location: "Bear Mountain State Park, NY",
    status: "open",
    userId: "user-1",
    spaceId: "space-1",
    options: [
      { startTime: d(11), duration: 0 },
      { startTime: d(12), duration: 0 },
      { startTime: d(18), duration: 0 },
      { startTime: d(19), duration: 0 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "yes", "no"],
      },
      {
        name: "Jordan Lee",
        email: "[email protected]",
        votes: ["yes", "no", "yes", "yes"],
      },
      {
        name: "Priya Patel",
        email: "[email protected]",
        note: "Still recovering from a knee injury, so I'd prefer a slower pace if that's ok.",
        votes: ["no", "yes", "yes", "ifNeedBe"],
      },
      {
        name: "Marcus Johnson",
        email: "[email protected]",
        note: "I'm away the following weekend so only the first two dates work for me.",
        votes: ["yes", "yes", "no", "no"],
      },
      {
        name: "Olivia Smith",
        email: "[email protected]",
        votes: ["ifNeedBe", "yes", "yes", "yes"],
      },
    ],
    comments: [
      {
        content: "Can we do the 6-mile loop this time?",
        authorName: "Jordan Lee",
      },
      {
        content: "I'd prefer the shorter trail if possible.",
        authorName: "Priya Patel",
      },
    ],
  },
  {
    title: "Dinner with the Johnsons",
    description: "Finding a good evening for dinner at their place.",
    status: "closed",
    closedReason: "auto",
    timeZone: "America/New_York",
    userId: "user-1",
    spaceId: "space-1",
    options: [
      { startTime: d(-21, 19), duration: 120 },
      { startTime: d(-20, 18), duration: 120 },
      { startTime: d(-14, 19), duration: 120 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "yes"],
      },
      {
        name: "Karen Johnson",
        email: "[email protected]",
        note: "We have a school event on the first evening, anything after that is fine.",
        votes: ["no", "yes", "yes"],
      },
      {
        name: "Tom Johnson",
        email: "[email protected]",
        votes: ["no", "yes", "ifNeedBe"],
      },
    ],
  },
  {
    title: "Book club meeting",
    description:
      "Discussing 'Project Hail Mary' by Andy Weir. Chapter 15 onwards.",
    location: "Public Library, Room 2B",
    status: "open",
    timeZone: "America/New_York",
    deadline: d(6),
    userId: "user-1",
    spaceId: "space-1",
    options: [
      { startTime: d(8, 19), duration: 90 },
      { startTime: d(9, 19), duration: 90 },
      { startTime: d(10, 19), duration: 90 },
      { startTime: d(15, 19), duration: 90 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "no", "yes"],
      },
      {
        name: "Nadia Kowalski",
        email: "[email protected]",
        votes: ["yes", "no", "yes", "yes"],
      },
      {
        name: "David Chen",
        email: "[email protected]",
        note: "Traveling for work the week of the 15th, so the earlier dates suit me best.",
        votes: ["yes", "ifNeedBe", "no", "no"],
      },
      {
        name: "Rachel Green",
        email: "[email protected]",
        note: "Still catching up on the reading, so the later dates give me more time.",
        votes: ["no", "yes", "yes", "ifNeedBe"],
      },
      {
        name: "Sam Williams",
        email: "[email protected]",
        votes: ["yes", "yes", "no", "no"],
      },
      {
        name: "Lisa Park",
        email: "[email protected]",
        votes: ["ifNeedBe", "yes", "yes", "yes"],
      },
    ],
    comments: [
      {
        content: "Can't wait to discuss the ending!",
        authorName: "Nadia Kowalski",
      },
      {
        content: "Wednesday works best for most people it seems.",
        authorName: "Dev User",
        userId: "user-1",
      },
    ],
  },
  {
    title: "Car service appointment",
    description: "Oil change and tire rotation at Mike's Auto.",
    location: "Mike's Auto Shop, 234 Elm St",
    status: "scheduled",
    timeZone: "America/New_York",
    userId: "user-1",
    spaceId: "space-1",
    scheduledEventId: "event-car-service",
    options: [
      { startTime: d(-24, 9), duration: 60 },
      { startTime: d(-23, 9), duration: 60 },
      { startTime: d(-22, 9), duration: 60 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "ifNeedBe"],
      },
    ],
  },
  {
    title: "Photography class",
    description:
      "Beginner landscape photography workshop at the community center.",
    location: "Riverside Community Center, Studio 3",
    status: "open",
    userId: "user-1",
    spaceId: "space-1",
    options: [
      { startTime: d(18), duration: 0 },
      { startTime: d(19), duration: 0 },
      { startTime: d(25), duration: 0 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "no"],
      },
      {
        name: "Mei Lin",
        email: "[email protected]",
        votes: ["yes", "no", "yes"],
      },
      {
        name: "Chris Anderson",
        email: "[email protected]",
        note: "I'm on a work trip for the first date, either of the others suits me.",
        votes: ["no", "yes", "yes"],
      },
    ],
  },
  {
    title: "Birthday party venue",
    description:
      "Picking a weekend for the surprise party. Keep it secret from Jake!",
    status: "open",
    userId: "user-1",
    spaceId: "space-1",
    options: [
      { startTime: d(8), duration: 0 },
      { startTime: d(9), duration: 0 },
      { startTime: d(15), duration: 0 },
      { startTime: d(16), duration: 0 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "yes", "yes"],
      },
      {
        name: "Aisha Mohammed",
        email: "[email protected]",
        votes: ["yes", "no", "yes", "no"],
      },
      {
        name: "Tyler Brooks",
        email: "[email protected]",
        note: "I coach on Saturday mornings so Sundays are much easier for me.",
        votes: ["no", "yes", "no", "yes"],
      },
      {
        name: "Hannah Kim",
        email: "[email protected]",
        votes: ["yes", "yes", "no", "ifNeedBe"],
      },
      {
        name: "Daniel Russo",
        email: "[email protected]",
        votes: ["yes", "ifNeedBe", "yes", "no"],
      },
      {
        name: "Sophie Turner",
        email: "[email protected]",
        votes: ["ifNeedBe", "yes", "yes", "yes"],
      },
      {
        name: "Ben Carter",
        email: "[email protected]",
        votes: ["yes", "yes", "no", "no"],
      },
      {
        name: "Nina Fernandez",
        email: "[email protected]",
        note: "Happy to come early and help set up whichever date we pick.",
        votes: ["yes", "no", "yes", "yes"],
      },
    ],
    comments: [
      {
        content: "Should we do a potluck or order catering?",
        authorName: "Aisha Mohammed",
      },
      {
        content: "Potluck sounds great! I can bring dessert.",
        authorName: "Hannah Kim",
      },
      {
        content: "I'll handle the decorations!",
        authorName: "Sophie Turner",
      },
    ],
  },
];

// ── Acme Inc polls ───────────────────────────────────────────────────────────

const acmePolls: PollDef[] = [
  {
    title: "Q2 Kickoff Meeting",
    description:
      "All-hands to review Q1 results and set Q2 objectives. Mandatory for all team leads.",
    location: "Main Conference Room",
    status: "open",
    timeZone: "America/New_York",
    userId: "user-1",
    spaceId: "space-2",
    options: [
      { startTime: d(4, 13), duration: 120 },
      { startTime: d(5, 13), duration: 120 },
      { startTime: d(6, 13), duration: 120 },
      { startTime: d(7, 13), duration: 120 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "yes", "no"],
      },
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["yes", "no", "yes", "yes"],
      },
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        note: "The last slot clashes with our release window but I can shuffle things if needed.",
        votes: ["yes", "yes", "no", "ifNeedBe"],
      },
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        note: "I'm out Monday but flexible otherwise. Can join remotely if needed.",
        votes: ["no", "yes", "yes", "yes"],
      },
      {
        name: "James Okonkwo",
        userId: "user-5",
        email: "[email protected]",
        votes: ["yes", "ifNeedBe", "yes", "no"],
      },
    ],
    comments: [
      {
        content: "Can we allocate 30 min for the engineering roadmap section?",
        authorName: "Michael Torres",
        userId: "user-3",
      },
    ],
  },
  {
    title: "Design Review: Homepage Redesign",
    description:
      "Walking through the new homepage mockups. Please review the Figma link before the meeting.",
    status: "open",
    timeZone: "America/New_York",
    userId: "user-2",
    spaceId: "space-2",
    options: [
      { startTime: d(5, 14), duration: 60 },
      { startTime: d(6, 14), duration: 60 },
      { startTime: d(7, 10), duration: 60 },
    ],
    participants: [
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["yes", "yes", "yes"],
      },
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "ifNeedBe", "no"],
      },
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        votes: ["no", "yes", "yes"],
      },
      {
        name: "Andrea Walsh",
        email: "[email protected]",
        note: "I'm at a client site on the last day, either afternoon slot works for me.",
        votes: ["yes", "yes", "no"],
      },
    ],
  },
  {
    title: "Sprint Retrospective",
    description: "Reflecting on Sprint 14. What went well, what didn't.",
    location: "Zoom",
    status: "closed",
    closedReason: "manual",
    timeZone: "America/New_York",
    userId: "user-3",
    spaceId: "space-2",
    options: [
      { startTime: d(-28, 15), duration: 60 },
      { startTime: d(-28, 16), duration: 60 },
      { startTime: d(-25, 15), duration: 60 },
    ],
    participants: [
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        votes: ["yes", "yes", "yes"],
      },
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["no", "yes", "yes"],
      },
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        note: "The 4pm slot overlaps with a meeting I can't move.",
        votes: ["yes", "no", "yes"],
      },
      {
        name: "James Okonkwo",
        userId: "user-5",
        email: "[email protected]",
        note: "I'm on support rotation the first day, the later date is safest for me.",
        votes: ["ifNeedBe", "no", "yes"],
      },
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        votes: ["no", "no", "yes"],
      },
    ],
  },
  {
    title: "Client Presentation Prep",
    description:
      "Final run-through before the Globex Corp pitch. Bring your slides.",
    location: "Zoom",
    status: "open",
    timeZone: "America/New_York",
    userId: "user-1",
    spaceId: "space-2",
    options: [
      { startTime: d(3, 10), duration: 60 },
      { startTime: d(3, 14), duration: 60 },
      { startTime: d(4, 10), duration: 60 },
      { startTime: d(4, 14), duration: 60 },
      { startTime: d(5, 10), duration: 60 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "no", "yes", "yes", "ifNeedBe"],
      },
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["yes", "yes", "no", "yes", "no"],
      },
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        votes: ["no", "yes", "yes", "no", "yes"],
      },
      {
        name: "James Okonkwo",
        userId: "user-5",
        email: "[email protected]",
        note: "I fly out midweek so the earlier sessions suit me much better.",
        votes: ["yes", "ifNeedBe", "yes", "no", "no"],
      },
    ],
  },
  {
    title: "Team Offsite Planning",
    description:
      "Picking a date for our spring team offsite. Thinking somewhere outdoors!",
    status: "open",
    userId: "user-1",
    spaceId: "space-2",
    options: [
      { startTime: d(11), duration: 0 },
      { startTime: d(12), duration: 0 },
      { startTime: d(18), duration: 0 },
      { startTime: d(19), duration: 0 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "yes", "no"],
      },
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["yes", "yes", "no", "yes"],
      },
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        votes: ["yes", "no", "yes", "yes"],
      },
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        note: "If we pick the last date I may need to leave early for a flight.",
        votes: ["no", "yes", "yes", "ifNeedBe"],
      },
      {
        name: "James Okonkwo",
        userId: "user-5",
        email: "[email protected]",
        votes: ["yes", "yes", "ifNeedBe", "no"],
      },
      {
        name: "Raj Gupta",
        email: "[email protected]",
        note: "Any date except the second works, I have a wedding that day.",
        votes: ["yes", "no", "yes", "yes"],
      },
    ],
    comments: [
      {
        content: "How about that ropes course in the Catskills?",
        authorName: "James Okonkwo",
        userId: "user-5",
      },
      {
        content: "Love that idea! We could do a BBQ afterwards.",
        authorName: "Sarah Chen",
        userId: "user-2",
      },
    ],
  },
  {
    title: "1:1 with Sarah",
    description: "Weekly sync — career goals and project updates.",
    status: "open",
    timeZone: "America/New_York",
    userId: "user-1",
    spaceId: "space-2",
    options: [
      { startTime: d(5, 15), duration: 30 },
      { startTime: d(6, 15), duration: 30 },
      { startTime: d(7, 15), duration: 30 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "ifNeedBe"],
      },
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        note: "The first slot lands right after another sync, the later two are better.",
        votes: ["no", "yes", "yes"],
      },
    ],
  },
  {
    title: "Engineering Standup Time Change",
    description:
      "Our current 9am ET standup doesn't work for everyone. Let's find a better slot.",
    status: "closed",
    closedReason: "auto",
    timeZone: "America/New_York",
    userId: "user-3",
    spaceId: "space-2",
    options: [
      { startTime: d(-24, 13), duration: 15 },
      { startTime: d(-24, 13, 30), duration: 15 },
      { startTime: d(-24, 14), duration: 15 },
      { startTime: d(-24, 14, 30), duration: 15 },
    ],
    participants: [
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        votes: ["yes", "yes", "yes", "yes"],
      },
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "ifNeedBe", "no"],
      },
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        note: "The earlier slots land at a rough hour in Tokyo, the later two are doable.",
        votes: ["no", "no", "yes", "yes"],
      },
      {
        name: "James Okonkwo",
        userId: "user-5",
        email: "[email protected]",
        votes: ["yes", "yes", "no", "no"],
      },
      {
        name: "Ana Costa",
        email: "[email protected]",
        note: "I do the school pickup, so the last slot doesn't work for me.",
        votes: ["ifNeedBe", "yes", "yes", "no"],
      },
    ],
  },
  {
    title: "Product Roadmap Workshop",
    description:
      "Half-day session to align on H2 priorities. We'll use the RICE framework.",
    status: "open",
    timeZone: "America/New_York",
    userId: "user-2",
    spaceId: "space-2",
    options: [
      { startTime: d(9, 13), duration: 180 },
      { startTime: d(10, 13), duration: 180 },
      { startTime: d(11, 13), duration: 180 },
    ],
    participants: [
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["yes", "yes", "yes"],
      },
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "no", "ifNeedBe"],
      },
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        note: "I'm on leave the last day, the first two are wide open for me.",
        votes: ["yes", "yes", "no"],
      },
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        votes: ["no", "yes", "yes"],
      },
      {
        name: "James Okonkwo",
        userId: "user-5",
        email: "[email protected]",
        note: "I can move a review on the second day if that's the one that wins.",
        votes: ["yes", "ifNeedBe", "yes"],
      },
    ],
  },
  {
    title: "Quarterly Business Review",
    description:
      "Presenting Q1 numbers to leadership. Finance team please prepare slides by Thursday.",
    status: "scheduled",
    timeZone: "America/New_York",
    userId: "user-1",
    spaceId: "space-2",
    scheduledEventId: "event-qbr",
    options: [
      { startTime: d(10, 14), duration: 120 },
      { startTime: d(14, 14), duration: 120 },
      { startTime: d(17, 14), duration: 120 },
      { startTime: d(18, 14), duration: 120 },
    ],
    participants: [
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "yes", "yes", "ifNeedBe"],
      },
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["no", "yes", "yes", "yes"],
      },
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        votes: ["yes", "no", "yes", "no"],
      },
      {
        name: "Carla Mendez",
        email: "[email protected]",
        note: "Finance close runs into the first date, later gives us time to finish the slides.",
        votes: ["ifNeedBe", "yes", "no", "yes"],
      },
      {
        name: "Owen Bradley",
        email: "[email protected]",
        note: "I'm at a conference for the last two dates, earlier works much better.",
        votes: ["yes", "yes", "no", "no"],
      },
    ],
  },
  {
    title: "Lunch & Learn: AI Tools",
    description:
      "Informal session on how we can use AI tools to speed up our workflow. Pizza provided!",
    location: "Conference Room B",
    status: "open",
    timeZone: "America/New_York",
    userId: "user-5",
    spaceId: "space-2",
    options: [
      { startTime: d(5, 12), duration: 60 },
      { startTime: d(6, 12), duration: 60 },
      { startTime: d(12, 12), duration: 60 },
    ],
    participants: [
      {
        name: "James Okonkwo",
        userId: "user-5",
        email: "[email protected]",
        votes: ["yes", "yes", "yes"],
      },
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "no", "yes"],
      },
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["yes", "yes", "no"],
      },
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        votes: ["no", "yes", "yes"],
      },
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        note: "I'm out of office the week of the last option.",
        votes: ["yes", "ifNeedBe", "no"],
      },
      {
        name: "Derek Hoffman",
        email: "[email protected]",
        note: "I have a standing call over the first slot but could join late if needed.",
        votes: ["ifNeedBe", "yes", "yes"],
      },
    ],
    comments: [
      {
        content: "Can we cover GitHub Copilot tips?",
        authorName: "Michael Torres",
        userId: "user-3",
      },
      {
        content: "I'd love to demo some prompt engineering techniques.",
        authorName: "James Okonkwo",
        userId: "user-5",
      },
    ],
  },
  {
    title: "Interview Panel: Senior Designer",
    description:
      "We have 3 candidates next week. Need at least 3 panelists per slot.",
    location: "Conference Room B",
    status: "open",
    timeZone: "America/New_York",
    requireParticipantEmail: true,
    userId: "user-2",
    spaceId: "space-2",
    options: [
      { startTime: d(15, 14), duration: 90 },
      { startTime: d(16, 14), duration: 90 },
      { startTime: d(17, 14), duration: 90 },
      { startTime: d(18, 14), duration: 90 },
    ],
    participants: [
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["yes", "yes", "yes", "no"],
      },
      {
        name: "Dev User",
        userId: "user-1",
        email: "[email protected]",
        votes: ["yes", "no", "yes", "yes"],
      },
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        votes: ["no", "yes", "no", "yes"],
      },
      {
        name: "Lena Novak",
        email: "[email protected]",
        note: "I'm out on the third day, and I'd need to move a workshop for the last one.",
        votes: ["yes", "yes", "no", "ifNeedBe"],
      },
    ],
  },
  {
    title: "Holiday Party Planning",
    description:
      "It's never too early! Let's lock down a date so we can book the venue.",
    status: "open",
    userId: "user-4",
    spaceId: "space-2",
    options: [
      { startTime: d(253), duration: 0 },
      { startTime: d(254), duration: 0 },
      { startTime: d(260), duration: 0 },
      { startTime: d(261), duration: 0 },
    ],
    participants: [
      {
        name: "Emily Nakamura",
        userId: "user-4",
        email: "[email protected]",
        votes: ["yes", "yes", "yes", "yes"],
      },
      {
        name: "Dev User",
        userId: "user-1",
        votes: ["yes", "no", "yes", "ifNeedBe"],
      },
      {
        name: "Sarah Chen",
        userId: "user-2",
        email: "[email protected]",
        votes: ["yes", "yes", "no", "yes"],
      },
      {
        name: "Michael Torres",
        userId: "user-3",
        email: "[email protected]",
        votes: ["no", "yes", "yes", "yes"],
      },
      {
        name: "James Okonkwo",
        userId: "user-5",
        email: "[email protected]",
        votes: ["yes", "ifNeedBe", "yes", "no"],
      },
      {
        name: "Raj Gupta",
        email: "[email protected]",
        note: "I'll be booking December travel soon, so an early decision helps me.",
        votes: ["yes", "yes", "no", "yes"],
      },
      {
        name: "Ana Costa",
        email: "[email protected]",
        note: "I might be traveling the first weekend but will know closer to the date.",
        votes: ["ifNeedBe", "yes", "yes", "yes"],
      },
    ],
    comments: [
      {
        content:
          "The rooftop bar on 8th Ave has availability for both December weekends.",
        authorName: "Emily Nakamura",
        userId: "user-4",
      },
    ],
  },
];

export const polls: PollDef[] = [...personalPolls, ...acmePolls];

// ─── Event Types ─────────────────────────────────────────────────────────────

type EventTypeLocation =
  | { type: "in_person"; address: string; placeId?: string }
  | { type: "custom_link"; url: string; text?: string };

export type EventTypeDef = {
  id: string;
  spaceId: string;
  hostId: string;
  name: string;
  duration: number;
  capacity: number | null;
  description: string | null;
  location: EventTypeLocation | null;
};

export const eventTypes: EventTypeDef[] = [
  // ── Personal space (space-1) ─────────────────────────────────────────────
  {
    id: "et-1",
    spaceId: "space-1",
    hostId: "user-1",
    name: "30 Minute Meeting",
    duration: 30,
    capacity: null,
    description: "Quick catch-up or intro.",
    location: {
      type: "custom_link",
      url: "https://zoom.us/j/1234567890",
      text: "Zoom",
    },
  },
  {
    id: "et-2",
    spaceId: "space-1",
    hostId: "user-1",
    name: "Coffee Chat",
    duration: 45,
    capacity: 1,
    description: null,
    location: {
      type: "in_person",
      address: "Café on 5th Ave, New York",
    },
  },

  // ── Acme Inc (space-2) ───────────────────────────────────────────────────
  {
    id: "et-3",
    spaceId: "space-2",
    hostId: "user-1",
    name: "Intro Call",
    duration: 15,
    capacity: null,
    description: "Brief intro to see if we're a fit.",
    location: {
      type: "custom_link",
      url: "https://meet.google.com/abc-defg-hij",
      text: "Google Meet",
    },
  },
  {
    id: "et-4",
    spaceId: "space-2",
    hostId: "user-2",
    name: "Product Demo",
    duration: 45,
    capacity: null,
    description: "Live walkthrough of the product.",
    location: {
      type: "custom_link",
      url: "https://zoom.us/j/9876543210",
    },
  },
  {
    id: "et-5",
    spaceId: "space-2",
    hostId: "user-3",
    name: "Office Hours",
    duration: 60,
    capacity: 5,
    description: "Drop-in time for engineering questions.",
    location: {
      type: "in_person",
      address: "Acme HQ, Conference Room B",
    },
  },
  {
    id: "et-6",
    spaceId: "space-2",
    hostId: "user-1",
    name: "Team Workshop",
    duration: 90,
    capacity: null,
    description: "Hands-on working session.",
    location: null,
  },
];

// ─── Scheduled Events ────────────────────────────────────────────────────────

export type ScheduledEventDef = {
  id?: string;
  title: string;
  description?: string;
  location?: { provider: "custom"; address: string };
  status: ScheduledEventStatus;
  timeZone?: string;
  start: string;
  end: string;
  allDay: boolean;
  userId: string;
  spaceId: string;
  invites?: Array<{
    inviteeName: string;
    inviteeEmail: string;
    inviteeTimeZone?: string;
    inviteeId?: string;
    status: ScheduledEventInviteStatus;
  }>;
};

export const scheduledEvents: ScheduledEventDef[] = [
  // ── Personal space events ──────────────────────────────────────────────────
  {
    title: "Dentist Appointment",
    location: { provider: "custom", address: "Dr. Lee's Office, 45 Oak St" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(-25, 14),
    end: d(-25, 15),
    allDay: false,
    userId: "user-1",
    spaceId: "space-1",
  },
  {
    title: "Dinner with Mom",
    location: { provider: "custom", address: "Olive Garden, Paramus" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(-20, 18),
    end: d(-20, 20),
    allDay: false,
    userId: "user-1",
    spaceId: "space-1",
  },
  {
    title: "Weekend Hiking Trip",
    description: "Bear Mountain — meet at the trailhead parking lot at 8am.",
    status: "confirmed",
    start: d(-19),
    end: d(-18),
    allDay: true,
    userId: "user-1",
    spaceId: "space-1",
    invites: [
      {
        inviteeName: "Jordan Lee",
        inviteeEmail: "[email protected]",
        status: "accepted",
      },
      {
        inviteeName: "Priya Patel",
        inviteeEmail: "[email protected]",
        status: "accepted",
      },
      {
        inviteeName: "Marcus Johnson",
        inviteeEmail: "[email protected]",
        status: "declined",
      },
    ],
  },
  {
    title: "Book Club",
    description: "Discussing 'Project Hail Mary'.",
    location: { provider: "custom", address: "Public Library, Room 2B" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(-16, 19),
    end: d(-16, 20, 30),
    allDay: false,
    userId: "user-1",
    spaceId: "space-1",
    invites: [
      {
        inviteeName: "Nadia Kowalski",
        inviteeEmail: "[email protected]",
        status: "accepted",
      },
      {
        inviteeName: "David Chen",
        inviteeEmail: "[email protected]",
        status: "tentative",
      },
      {
        inviteeName: "Rachel Green",
        inviteeEmail: "[email protected]",
        status: "accepted",
      },
      {
        inviteeName: "Sam Williams",
        inviteeEmail: "[email protected]",
        status: "pending",
      },
    ],
  },
  {
    id: "event-car-service",
    title: "Car Service",
    location: { provider: "custom", address: "Mike's Auto Shop, 234 Elm St" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(-24, 9),
    end: d(-24, 10),
    allDay: false,
    userId: "user-1",
    spaceId: "space-1",
  },
  {
    title: "Coffee with Alex",
    location: { provider: "custom", address: "Café on 5th" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(7, 10),
    end: d(7, 11),
    allDay: false,
    userId: "user-1",
    spaceId: "space-1",
    invites: [
      {
        inviteeName: "Alex Rivera",
        inviteeEmail: "[email protected]",
        status: "accepted",
      },
    ],
  },

  // ── Acme Inc events ────────────────────────────────────────────────────────
  {
    title: "Sprint 14 Retrospective",
    description: "Reflecting on what went well and what to improve.",
    location: { provider: "custom", address: "Zoom" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(-28, 15),
    end: d(-28, 16),
    allDay: false,
    userId: "user-3",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Dev User",
        inviteeEmail: "[email protected]",
        inviteeId: "user-1",
        inviteeTimeZone: "America/New_York",
        status: "accepted",
      },
      {
        inviteeName: "Sarah Chen",
        inviteeEmail: "[email protected]",
        inviteeId: "user-2",
        inviteeTimeZone: "America/Los_Angeles",
        status: "accepted",
      },
      {
        inviteeName: "Emily Nakamura",
        inviteeEmail: "[email protected]",
        inviteeId: "user-4",
        inviteeTimeZone: "Asia/Tokyo",
        status: "declined",
      },
      {
        inviteeName: "James Okonkwo",
        inviteeEmail: "[email protected]",
        inviteeId: "user-5",
        inviteeTimeZone: "America/Chicago",
        status: "accepted",
      },
    ],
  },
  {
    title: "Design Review: Homepage",
    description: "Review the latest homepage mockups in Figma.",
    location: { provider: "custom", address: "Conference Room A" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(-22, 14),
    end: d(-22, 15),
    allDay: false,
    userId: "user-2",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Dev User",
        inviteeEmail: "[email protected]",
        inviteeId: "user-1",
        inviteeTimeZone: "America/New_York",
        status: "accepted",
      },
      {
        inviteeName: "Emily Nakamura",
        inviteeEmail: "[email protected]",
        inviteeId: "user-4",
        inviteeTimeZone: "Asia/Tokyo",
        status: "accepted",
      },
    ],
  },
  {
    title: "Client Presentation: Globex Corp",
    description: "Final pitch to the Globex leadership team.",
    location: { provider: "custom", address: "Globex HQ, 100 Innovation Blvd" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(-14, 10),
    end: d(-14, 11, 30),
    allDay: false,
    userId: "user-1",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Sarah Chen",
        inviteeEmail: "[email protected]",
        inviteeId: "user-2",
        inviteeTimeZone: "America/Los_Angeles",
        status: "accepted",
      },
      {
        inviteeName: "Michael Torres",
        inviteeEmail: "[email protected]",
        inviteeId: "user-3",
        inviteeTimeZone: "Europe/London",
        status: "accepted",
      },
      {
        inviteeName: "James Okonkwo",
        inviteeEmail: "[email protected]",
        inviteeId: "user-5",
        inviteeTimeZone: "America/Chicago",
        status: "tentative",
      },
    ],
  },
  {
    title: "Engineering All-Hands",
    description: "Monthly engineering department sync.",
    status: "canceled",
    timeZone: "America/New_York",
    start: d(-27, 17),
    end: d(-27, 18),
    allDay: false,
    userId: "user-3",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Dev User",
        inviteeEmail: "[email protected]",
        inviteeId: "user-1",
        status: "accepted",
      },
      {
        inviteeName: "Emily Nakamura",
        inviteeEmail: "[email protected]",
        inviteeId: "user-4",
        status: "accepted",
      },
    ],
  },
  {
    title: "Lunch & Learn: AI Tools",
    description: "Exploring AI productivity tools. Pizza provided!",
    location: { provider: "custom", address: "Conference Room B" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(-21, 12),
    end: d(-21, 13),
    allDay: false,
    userId: "user-5",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Dev User",
        inviteeEmail: "[email protected]",
        inviteeId: "user-1",
        status: "accepted",
      },
      {
        inviteeName: "Sarah Chen",
        inviteeEmail: "[email protected]",
        inviteeId: "user-2",
        status: "accepted",
      },
      {
        inviteeName: "Michael Torres",
        inviteeEmail: "[email protected]",
        inviteeId: "user-3",
        status: "accepted",
      },
      {
        inviteeName: "Emily Nakamura",
        inviteeEmail: "[email protected]",
        inviteeId: "user-4",
        status: "tentative",
      },
    ],
  },
  {
    title: "Q2 Kickoff",
    description: "All-hands to review Q1 and set Q2 objectives.",
    location: { provider: "custom", address: "Main Conference Room" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(7, 13),
    end: d(7, 15),
    allDay: false,
    userId: "user-1",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Sarah Chen",
        inviteeEmail: "[email protected]",
        inviteeId: "user-2",
        status: "accepted",
      },
      {
        inviteeName: "Michael Torres",
        inviteeEmail: "[email protected]",
        inviteeId: "user-3",
        status: "accepted",
      },
      {
        inviteeName: "Emily Nakamura",
        inviteeEmail: "[email protected]",
        inviteeId: "user-4",
        status: "accepted",
      },
      {
        inviteeName: "James Okonkwo",
        inviteeEmail: "[email protected]",
        inviteeId: "user-5",
        status: "accepted",
      },
    ],
  },
  {
    title: "Product Roadmap Workshop",
    description:
      "Half-day session to align on H2 priorities using RICE framework.",
    location: { provider: "custom", address: "Conference Room A" },
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(9, 13),
    end: d(9, 16),
    allDay: false,
    userId: "user-2",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Dev User",
        inviteeEmail: "[email protected]",
        inviteeId: "user-1",
        status: "accepted",
      },
      {
        inviteeName: "Michael Torres",
        inviteeEmail: "[email protected]",
        inviteeId: "user-3",
        status: "accepted",
      },
      {
        inviteeName: "Emily Nakamura",
        inviteeEmail: "[email protected]",
        inviteeId: "user-4",
        status: "accepted",
      },
      {
        inviteeName: "James Okonkwo",
        inviteeEmail: "[email protected]",
        inviteeId: "user-5",
        status: "tentative",
      },
    ],
  },
  {
    title: "Team Offsite",
    description: "Spring team-building day at the Catskills ropes course.",
    status: "confirmed",
    start: d(12),
    end: d(13),
    allDay: true,
    userId: "user-1",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Sarah Chen",
        inviteeEmail: "[email protected]",
        inviteeId: "user-2",
        status: "accepted",
      },
      {
        inviteeName: "Michael Torres",
        inviteeEmail: "[email protected]",
        inviteeId: "user-3",
        status: "accepted",
      },
      {
        inviteeName: "Emily Nakamura",
        inviteeEmail: "[email protected]",
        inviteeId: "user-4",
        status: "accepted",
      },
      {
        inviteeName: "James Okonkwo",
        inviteeEmail: "[email protected]",
        inviteeId: "user-5",
        status: "pending",
      },
    ],
  },
  {
    id: "event-qbr",
    title: "Quarterly Business Review",
    description:
      "Presenting Q1 numbers to leadership. Finance team please prepare slides by Thursday.",
    status: "confirmed",
    timeZone: "America/New_York",
    start: d(14, 14),
    end: d(14, 16),
    allDay: false,
    userId: "user-1",
    spaceId: "space-2",
    invites: [
      {
        inviteeName: "Sarah Chen",
        inviteeEmail: "[email protected]",
        inviteeId: "user-2",
        inviteeTimeZone: "America/Los_Angeles",
        status: "accepted",
      },
      {
        inviteeName: "Michael Torres",
        inviteeEmail: "[email protected]",
        inviteeId: "user-3",
        inviteeTimeZone: "Europe/London",
        status: "accepted",
      },
      {
        inviteeName: "Carla Mendez",
        inviteeEmail: "[email protected]",
        status: "accepted",
      },
      {
        inviteeName: "Owen Bradley",
        inviteeEmail: "[email protected]",
        status: "accepted",
      },
    ],
  },
];