# Ticket Tiers

### Overview

The ticket tiers system manages event attendance through a ticketing mechanism where every event automatically includes a default free ticket (cost = 0). This ensures basic access control and attendance tracking even for free events.

### Data Model

```typescript
interface EventTicket {
  _id: MongoID;
  active: Boolean;
  address_required: Boolean;
  approval_required: Boolean;
  category: MongoID;
  category_expanded: EventTicketCategory;
  default: Boolean;
  description: String;
  description_line: String;
  event: MongoID;
  external_ids: String[];
  limited: Boolean;
  limited_whitelist_users: WhitelistUserInfo[];
  offers: EventOffer[];
  photos: MongoID[];
  photos_expanded: File[];
  position: Int;
  prices: EventTicketPrice[];
  private: Boolean;
  ticket_count: Float;
  ticket_limit: Float;
  ticket_limit_per: Float;
  title: String;
}
```

### Ticket Settings & Features

#### Basic Information

* Title (required)
* Description (optional)
* Category selection

```
# Get list of ticket categories
Query.getEventTicketCategories

# Create new category
Mutation.createEventTicketCategory

# Update existing category
Mutation.updateEventTicketCategory

# Delete category (only if no tickets are assigned)
Mutation.deleteEventTicketCategory
```

#### Access Control Settings

1. Group Registration
   * Enables ticket limit per guest
   * Controls `ticket_limit_per` field
2. Ticket Status

   * Activate ticket: Controls `active` field
   * List ticket: Controls `private` field
   * Lock ticket: Controls whitelist functionality

   ```typescript
   interface TicketStatus {
     active: boolean;    // Available for purchase
     private: boolean;   // Hidden from public listing
     limited: boolean;   // Whitelist restriction enabled
   }
   ```
3. Whitelist Control
   * When enabled (`limited: true`):
     * Only whitelisted users can purchase
     * Managed through `limited_whitelist_users` array\\

#### Pricing & Payment

* Stored in `prices` array
* Each price can have different conditions
* Support for multiple payment methods

Price Data Model

```javascript
TicketPrice {
  cost: string;        // Token amount in string to handle large numbers
  currency: string;    // Token symbol (e.g., "ETH", "USDT")
  decimals: number;    // Token decimal places (e.g., 18 for ETH)
  default: boolean;    // Is this the default payment option
  network: string;     // Blockchain network (e.g., "ethereum", "polygon")
}
```

#### Main Settings Controls

1. Group Registration Toggle
   * Enables/disables ticket limit per guest
   * Updates `ticket_limit_per` field
2. Status Toggles
   * Activate ticket: Toggle for availability
   * List ticket: Toggle for public visibility
   * Lock ticket: Toggle for whitelist restriction
3. Payment Methods
   * Add multiple payment options
   * Each tied to specific price points

### Business Rules

1. Ticket Activation
   * Tickets must have at least one price point to be activated
   * Cannot be activated without proper category assignment
2. Whitelist Restrictions
   * When enabled:
     * Must maintain whitelist user array
     * Cannot be publicly listed
     * Requires approval process
3. Group Registration
   * When enabled:
     * Must specify ticket limit per guest
     * Validates against total ticket limit

### API Endpoints

#### Ticket Management

```
Query listEventTicketTypes
Mutation createEventTicketType
Mutation updateEventTicketType
Mutation deleteEventTicketType
```
