-- ============================================ -- TEMPLATE-SAAS: Enum Types -- Version: 1.0.0 -- ============================================ -- Auth enums CREATE TYPE auth.token_type AS ENUM ('access', 'refresh', 'reset_password', 'email_verification', 'api_key'); CREATE TYPE auth.oauth_provider AS ENUM ('google', 'microsoft', 'github', 'apple'); CREATE TYPE auth.session_status AS ENUM ('active', 'expired', 'revoked'); -- Tenant enums CREATE TYPE tenants.tenant_status AS ENUM ('pending', 'active', 'suspended', 'cancelled'); CREATE TYPE tenants.subscription_status AS ENUM ('trialing', 'active', 'past_due', 'cancelled', 'unpaid'); -- User enums CREATE TYPE users.user_status AS ENUM ('pending', 'active', 'suspended', 'deleted'); CREATE TYPE users.invitation_status AS ENUM ('pending', 'accepted', 'expired', 'cancelled'); -- Billing enums CREATE TYPE billing.payment_status AS ENUM ('pending', 'processing', 'succeeded', 'failed', 'refunded', 'cancelled'); CREATE TYPE billing.invoice_status AS ENUM ('draft', 'open', 'paid', 'void', 'uncollectible'); CREATE TYPE billing.billing_interval AS ENUM ('month', 'year'); CREATE TYPE billing.payment_method_type AS ENUM ('card', 'bank_transfer', 'oxxo'); CREATE TYPE billing.subscription_status AS ENUM ('trial', 'active', 'past_due', 'cancelled', 'expired'); -- Notification enums CREATE TYPE notifications.channel AS ENUM ('email', 'push', 'in_app', 'sms', 'whatsapp'); CREATE TYPE notifications.notification_status AS ENUM ('pending', 'sent', 'delivered', 'failed', 'read'); CREATE TYPE notifications.priority AS ENUM ('low', 'normal', 'high', 'urgent'); CREATE TYPE notifications.queue_status AS ENUM ('queued', 'processing', 'sent', 'failed', 'retrying'); CREATE TYPE notifications.device_type AS ENUM ('web', 'mobile', 'desktop'); -- Feature flag enums CREATE TYPE feature_flags.flag_status AS ENUM ('disabled', 'enabled', 'percentage', 'user_list'); CREATE TYPE feature_flags.rollout_stage AS ENUM ('development', 'internal', 'beta', 'general'); -- Audit enums CREATE TYPE audit.action_type AS ENUM ('create', 'read', 'update', 'delete', 'login', 'logout', 'export', 'import'); CREATE TYPE audit.severity AS ENUM ('info', 'warning', 'error', 'critical'); -- Storage enums CREATE TYPE storage.file_status AS ENUM ('uploading', 'processing', 'ready', 'failed', 'deleted'); CREATE TYPE storage.visibility AS ENUM ('private', 'tenant', 'public'); CREATE TYPE storage.storage_provider AS ENUM ('s3', 'r2', 'minio', 'gcs'); -- AI enums CREATE TYPE ai.ai_provider AS ENUM ('openrouter', 'openai', 'anthropic', 'google'); CREATE TYPE ai.ai_model_type AS ENUM ('chat', 'completion', 'embedding', 'image'); CREATE TYPE ai.usage_status AS ENUM ('pending', 'completed', 'failed', 'cancelled'); -- Webhook enums CREATE TYPE webhooks.delivery_status AS ENUM ('pending', 'delivered', 'failed', 'retrying'); CREATE TYPE webhooks.event_type AS ENUM ( 'user.created', 'user.updated', 'user.deleted', 'subscription.created', 'subscription.updated', 'subscription.cancelled', 'invoice.paid', 'invoice.failed', 'file.uploaded', 'file.deleted', 'tenant.updated' ); -- WhatsApp enums CREATE TYPE whatsapp.message_status AS ENUM ('pending', 'sent', 'delivered', 'read', 'failed'); CREATE TYPE whatsapp.message_type AS ENUM ('text', 'template', 'image', 'document', 'audio', 'video', 'location', 'contacts', 'interactive'); CREATE TYPE whatsapp.message_direction AS ENUM ('outbound', 'inbound');