import { CollectionConfig } from "payload"; /** * Per-player respawn ticket balances. Tickets are awarded automatically when a * mission is "settled" (see src/lib/respawn-tickets/index.ts): each attendee * earns 1 ticket for a "yes" RSVP, 0.5 for "tentative", 0.25 for "no", and * nothing when they attend without an RSVP. Balances accumulate across * missions and are served to the Arma 3 mod via the arma-bridge tickets * route, which loads them into the game at mission start. * * Written internally by the settlement lib (overrideAccess); the admin panel * is read-only so balance changes always have a settlement behind them. */ export const RespawnTickets: CollectionConfig = { slug: "respawn-tickets", admin: { group: "Server", useAsTitle: "user", defaultColumns: ["user", "balance"] }, access: { read: ({ req }) => !!req.user, create: () => false, update: () => false, delete: () => false, }, fields: [ { name: "user", type: "relationship", relationTo: "users", required: true, unique: true, index: true }, { name: "balance", type: "number", defaultValue: 0, admin: { description: "Accumulated respawn tickets (1 per yes-attended op, 0.5 tentative, 0.25 no). Maintained by settlement; read-only.", }, }, ], };