/** * Collections Types * Type definitions for the Collections feature */ // ============================================ // Content Types // ============================================ export type CollectionContentType = 'channel' | 'movie' | 'series'; // ============================================ // Database Types (snake_case - matches Supabase) // ============================================ export interface DatabaseCollection { id: string; profile_id: string; user_id: string; name: string; description: string | null; accent_color: string | null; is_private: boolean; is_pinned?: boolean; // Optional - may not exist in older databases sort_order: number; created_at: string; updated_at: string; } export interface DatabaseCollectionItem { id: string; collection_id: string; content_id: string; content_type: CollectionContentType; content_name: string | null; content_image_url: string | null; sort_order: number; added_at: string; } export interface DatabaseCollectionShare { id: string; collection_id: string; shared_with_profile_id: string; permission: 'view' | 'edit'; shared_at: string; accessed_at: string | null; } // ============================================ // App Types (camelCase - used in UI) // ============================================ export interface Collection { id: string; profileId: string; userId: string; name: string; description?: string; accentColor: string; isPrivate: boolean; isPinned: boolean; sortOrder: number; createdAt: string; updatedAt: string; // Computed/joined fields itemCount?: number; items?: CollectionItem[]; previewImages?: string[]; // First 4-5 item images for cover sharedWithProfiles?: string[]; // Profile IDs this collection is shared with } export interface CollectionItem { id: string; collectionId: string; contentId: string; contentType: CollectionContentType; contentName?: string; contentImageUrl?: string; sortOrder: number; addedAt: string; } export interface CollectionShare { id: string; collectionId: string; sharedWithProfileId: string; permission: 'view' | 'edit'; sharedAt: string; accessedAt?: string; } // ============================================ // Input Types (for CRUD operations) // ============================================ export interface CreateCollectionInput { profileId: string; name: string; description?: string; accentColor?: string; } export interface UpdateCollectionInput { name?: string; description?: string; accentColor?: string; sortOrder?: number; } export interface ShareCollectionInput { collectionId: string; profileId: string; permission?: 'view' | 'edit'; } export interface AddToCollectionInput { collectionId: string; contentId: string; contentType: CollectionContentType; contentName?: string; contentImageUrl?: string; } export interface ReorderCollectionItemsInput { collectionId: string; itemIds: string[]; // Ordered array of item IDs } // ============================================ // Collection with Items (joined type) // ============================================ export interface CollectionWithItems extends Collection { items: CollectionItem[]; } // ============================================ // Constants // ============================================ /** Predefined accent color palette for collections */ export const COLLECTION_COLORS = [ // Primary colors '#A91B18', // Tuscan Red (default - matches brand) '#3B82F6', // Blue '#10B981', // Green '#F59E0B', // Amber '#EC4899', // Pink '#6366F1', // Indigo '#14B8A6', // Teal '#8B5CF6', // Purple // Extended palette '#EF4444', // Red '#F97316', // Orange '#84CC16', // Lime '#06B6D4', // Cyan '#A855F7', // Violet '#E879F9', // Fuchsia '#78716C', // Stone '#1E293B', // Slate Dark ] as const; export type CollectionColor = (typeof COLLECTION_COLORS)[number]; /** Default accent color for new collections */ export const DEFAULT_COLLECTION_COLOR = COLLECTION_COLORS[0]; /** Maximum collections per profile (free tier) */ export const MAX_COLLECTIONS_PER_PROFILE = 10; /** Maximum collections for premium users (unlimited = -1) */ export const MAX_COLLECTIONS_PREMIUM = -1; /** Maximum items per collection */ export const MAX_ITEMS_PER_COLLECTION = 500;