"""
Global choices used across the entire project.
"""

# User role choices
ROLE_ADMIN = 'admin'
ROLE_SUPPORT_STAFF = 'support_staff'
ROLE_ACCOUNTS_STAFF = 'accounts_staff'
ROLE_TEACHER = 'teacher'
ROLE_STUDENT = 'student'

ROLE_CHOICES = [
    (ROLE_ADMIN, 'Admin'),
    (ROLE_SUPPORT_STAFF, 'Support Staff'),
    (ROLE_ACCOUNTS_STAFF, 'Accounts Staff'),
    (ROLE_TEACHER, 'Teacher'),
    (ROLE_STUDENT, 'Student'),
]

# Course status choices
COURSE_DRAFT = 'draft'
COURSE_PUBLISHED = 'published'

COURSE_STATUS_CHOICES = [
    (COURSE_DRAFT, 'Draft'),
    (COURSE_PUBLISHED, 'Published'),
]

# Enrollment status choices
ENROLLMENT_PENDING = 'pending'
ENROLLMENT_APPROVED = 'approved'
ENROLLMENT_REJECTED = 'rejected'

ENROLLMENT_STATUS_CHOICES = [
    (ENROLLMENT_PENDING, 'Pending'),
    (ENROLLMENT_APPROVED, 'Approved'),
    (ENROLLMENT_REJECTED, 'Rejected'),
]

# Payment method choices (also defined on Enrollment model)
PAYMENT_MANUAL = 'manual'
PAYMENT_STRIPE = 'stripe'
PAYMENT_FREE = 'free'

# ---------------------------------------------------------------------------
# Support tickets
# ---------------------------------------------------------------------------
TICKET_OPEN = 'open'
TICKET_IN_PROGRESS = 'in_progress'
TICKET_RESOLVED = 'resolved'
TICKET_CLOSED = 'closed'

TICKET_STATUS_CHOICES = [
    (TICKET_OPEN, 'Open'),
    (TICKET_IN_PROGRESS, 'In Progress'),
    (TICKET_RESOLVED, 'Resolved'),
    (TICKET_CLOSED, 'Closed'),
]

TICKET_PRIORITY_LOW = 'low'
TICKET_PRIORITY_MEDIUM = 'medium'
TICKET_PRIORITY_HIGH = 'high'

TICKET_PRIORITY_CHOICES = [
    (TICKET_PRIORITY_LOW, 'Low'),
    (TICKET_PRIORITY_MEDIUM, 'Medium'),
    (TICKET_PRIORITY_HIGH, 'High'),
]

TICKET_CAT_GENERAL = 'general'
TICKET_CAT_ENROLLMENT = 'enrollment'
TICKET_CAT_PAYMENT = 'payment'
TICKET_CAT_TECHNICAL = 'technical'
TICKET_CAT_COURSE = 'course'
TICKET_CAT_ACCOUNT = 'account'

TICKET_CATEGORY_CHOICES = [
    (TICKET_CAT_GENERAL, 'General'),
    (TICKET_CAT_ENROLLMENT, 'Enrollment'),
    (TICKET_CAT_PAYMENT, 'Payment'),
    (TICKET_CAT_TECHNICAL, 'Technical'),
    (TICKET_CAT_COURSE, 'Course content'),
    (TICKET_CAT_ACCOUNT, 'Account'),
]

# Theme presets (applied when not using fully custom values)
THEME_PRESET_CHOICES = [
    ('ocean', 'Ocean Blue (default)'),
    ('emerald', 'Emerald Green'),
    ('sunset', 'Sunset Amber'),
    ('slate', 'Slate Professional'),
    ('rose', 'Rose Accent'),
    ('custom', 'Custom colors'),
]

THEME_PRESETS = {
    'ocean': {
        'primary': '#1e40af',
        'secondary': '#0f2557',
        'accent': '#f59e0b',
        'success': '#059669',
    },
    'emerald': {
        'primary': '#047857',
        'secondary': '#064e3b',
        'accent': '#fbbf24',
        'success': '#10b981',
    },
    'sunset': {
        'primary': '#c2410c',
        'secondary': '#7c2d12',
        'accent': '#f59e0b',
        'success': '#15803d',
    },
    'slate': {
        'primary': '#334155',
        'secondary': '#0f172a',
        'accent': '#38bdf8',
        'success': '#0d9488',
    },
    'rose': {
        'primary': '#be123c',
        'secondary': '#881337',
        'accent': '#fbbf24',
        'success': '#059669',
    },
}

# Human-readable role capabilities (used on Roles page)
ROLE_PERMISSIONS = {
    'admin': [
        'Full access to academy settings, branding, theme colors, currency, and payments',
        'Manage all users and assign roles (including Accounts Staff and Support Staff)',
        'Create, edit, and delete any course and assign teachers',
        'Manage certification programs, assign teachers/proctors, MCQ banks, and certificates',
        'View all fees, payments, and earnings',
        'Review and approve/reject all enrollments and certification payments',
        'Handle all support tickets and permanently delete tickets',
    ],
    'accounts_staff': [
        'View course and certification fees, payments, and financial details',
        'Review and approve/reject enrollment payment proofs',
        'Approve certification fee / reattempt payments',
        'View issued certificates and payment-related applications',
        'Cannot change academy settings, manage courses/content, or assign user roles',
        'Cannot see or manage teaching content beyond financial review',
    ],
    'support_staff': [
        'Respond to and update support tickets and contact inquiries',
        'Help with schedules, bookings, and student support workflows',
        'View admissions queues for assistance (payment approval is Accounts Staff)',
        'Cannot change academy settings, theme, or delete tickets',
        'Cannot manage course content, certification question banks, or fees/earnings',
    ],
    'teacher': [
        'Manage assigned courses, modules, and lessons (no fee or pricing access)',
        'See students enrolled in assigned courses',
        'Proctor certification exams only for programs you are assigned to',
        'Cannot view fees, payment proofs, earnings, or approve payments',
        'Open and reply to own support tickets',
        'View teacher dashboard for assigned courses and students',
    ],
    'student': [
        'Browse and enroll in published courses',
        'Apply for skill certifications, pay fee/reattempt fee, join live proctor meeting, take MCQ exams',
        'Receive and share verifiable certificates with unique codes',
        'Pay via Manual or Stripe (as enabled)',
        'Access approved course lessons',
        'Manage own profile and enrollments',
        'Open and follow up on support tickets',
    ],
}
