import type { BookingPaymentOptionsSource, BookingPaymentTermsConfig, BookingPricing, BookingPricingInput, WaitlistOverride } from "./bookingConfig";
import type { PublicTeamMemberSummary } from "./teamMembers";
/**
 * Course Contracts
 *
 * These types cover course records, public course payloads, enrollments, and
 * waitlist/admin workflows.
 *
 * Note: Do NOT use these API types as validation schemas. They document wire
 * contracts while the owning services validate and normalize inputs.
 */
export type CourseStatus = "draft" | "active" | "cancelled" | "archived" | "completed";
/**
 * Backwards-compatible alias for mutation-safe course statuses.
 *
 * Historically this excluded `completed`; keep that behavior so callers that
 * relied on `MutableCourseStatus` continue to typecheck.
 */
export type MutableCourseStatus = Exclude<CourseStatus, "completed">;
export type CourseSessionInput = {
    startsAt: string;
    endsAt: string;
};
export type CreateCourseRequest = {
    enrollmentCapacity?: number | null;
    acceptsMemberships?: boolean;
    waitlistMode?: WaitlistOverride;
    pricing?: BookingPricingInput;
    priceCents?: number | null;
    currency?: string;
    paymentTerms?: BookingPaymentTermsConfig;
    paymentOptionsSource?: BookingPaymentOptionsSource;
    status?: CourseStatus;
    title: string;
    slug: string;
    venueId?: string | null;
    capacity?: number | null;
    formId?: string | null;
    eventCategoryId?: string | null;
    staffMemberIds?: string[];
    sessions: CourseSessionInput[];
    programId?: string | null;
    contentEntryId?: string | null;
    defaultStartTime?: string;
    durationMinutes?: number;
};
export type CourseSeriesRecord = {
    id: string;
    title: string;
    slug: string;
    /** Denormalized presentation projection from the linked content entry (e.g. summary). */
    presentationJson: unknown | null;
    venueId: string | null;
    capacity: number | null;
    eventCategoryId: string | null;
    staffMemberIds?: string[];
    status: string;
};
export type CourseRecord = {
    id: string;
    siteId: string;
    seriesId: string;
    programId: string | null;
    enrollmentCapacity: number | null;
    acceptsMemberships: boolean;
    waitlistMode: WaitlistOverride;
    pricing?: BookingPricing;
    priceCents: number | null;
    currency: string;
    paymentTerms: BookingPaymentTermsConfig;
    status: CourseStatus;
    contentEntryId: string | null;
    createdAt: string;
    updatedAt: string;
    series: CourseSeriesRecord;
    sessionsCount: number;
    /** Total enrollments for this course run (all statuses, including cancelled/waitlist). */
    enrollmentsCount: number;
    /** Seat-holding enrollments (enrolled, pending_payment, completed). */
    enrolledCount: number;
};
export type PublicCourseSession = {
    id: string;
    startsAt: string;
    endsAt: string;
    capacityOverride?: number | null;
    overrides?: Record<string, unknown> | null;
};
export type PublicCourseVenue = {
    id: string;
    name: string;
    address: string | null;
};
export type PublicCourseDetails = {
    id: string;
    title: string;
    slug: string;
    description: unknown;
    teamMembers?: PublicTeamMemberSummary[];
    enrollmentOpen: boolean;
    pricing?: BookingPricing;
    priceCents: number | null;
    currency: string;
    paymentTerms: BookingPaymentTermsConfig;
    enrollmentCapacity: number | null;
    acceptsMemberships: boolean;
    status: string;
    sessionsCount: number;
    enrolledCount: number;
    availableSpots: number | null;
    sessions: PublicCourseSession[];
    venue: PublicCourseVenue | null;
    contentEntryId: string | null;
    firstSessionAt: string | null;
    lastSessionAt: string | null;
};
export type CreateCourseResponse = {
    course: CourseRecord;
};
export type UpdateCourseRequest = {
    enrollmentCapacity?: number | null;
    acceptsMemberships?: boolean;
    waitlistMode?: WaitlistOverride;
    pricing?: BookingPricingInput;
    priceCents?: number | null;
    currency?: string;
    paymentTerms?: BookingPaymentTermsConfig;
    paymentOptionsSource?: BookingPaymentOptionsSource;
    status?: CourseStatus;
    cancelAndArchive?: boolean;
    title?: string;
    venueId?: string | null;
    capacity?: number | null;
    formId?: string | null;
    eventCategoryId?: string | null;
    staffMemberIds?: string[];
};
export type UpdateCourseResponse = {
    course: CourseRecord;
};
export type DeleteCourseResponse = {
    message: string;
};
export type DeleteCourseProgramResponse = {
    message: string;
};
export type DuplicateCourseRequest = {
    newStartDate: string;
    newStartTime: string;
    title?: string;
    slug?: string;
    enrollmentCapacity?: number | null;
    priceCents?: number | null;
};
export type DuplicateCourseResponse = {
    course: CourseRecord;
};
export type CourseEnrollmentStatus = "pending_payment" | "enrolled" | "waitlist" | "cancelled" | "completed";
export type CourseEnrollmentPaymentMethod = "free" | "membership" | "stripe" | null;
export type CourseEnrollmentPaymentStatus = "not_required" | "pending" | "completed" | "failed" | "refunded" | null;
export type CourseEnrollmentRecord = {
    id: string;
    siteId: string;
    courseId: string;
    customerId: string;
    status: CourseEnrollmentStatus;
    paymentMethod: CourseEnrollmentPaymentMethod;
    paymentStatus: CourseEnrollmentPaymentStatus;
    customerMembershipId: string | null;
    enrolledAt: string | null;
    cancelledAt: string | null;
    createdAt: string;
    updatedAt: string;
};
export type CourseEnrollmentWithCustomer = CourseEnrollmentRecord & {
    customer: {
        id: string;
        name: string | null;
        email: string | null;
        phone: string | null;
    };
    participantId?: string | null;
    participantParticipationId?: string | null;
    waitlistPosition?: number | null;
};
export type ListCourseEnrollmentsResponse = {
    enrollments: CourseEnrollmentWithCustomer[];
    summary: {
        enrolled: number;
        waitlist: number;
        capacity: number | null;
    };
};
export type DashboardWaitlistEntryStatus = "waiting" | "invited" | "inviteExpired" | "cancelled";
export type DashboardWaitlistEntry = {
    id: string;
    customerId: string;
    customerName: string;
    customerEmail: string;
    customerPhone: string | null;
    status: DashboardWaitlistEntryStatus;
    joinedAt: string;
    inviteExpiresAt: string | null;
    canResendInvite: boolean;
    canCancel: boolean;
    formSnapshot: Record<string, unknown>;
    metadata: Record<string, unknown>;
    occurrenceId?: string | null;
    eventTitle?: string | null;
    eventStartsAt?: string | null;
    eventTimeZone?: string | null;
};
export type DashboardWaitlistListResponse = {
    entries: DashboardWaitlistEntry[];
    summary: {
        waiting: number;
    };
};
export type WaitlistDashboardActionResponse = {
    success: true;
};
export type AddCourseEnrollmentRequest = {
    customerId?: string;
    customerName?: string;
    customerEmail?: string;
    customerPhone?: string | null;
    status?: "enrolled" | "waitlist";
    formSubmissionJson?: Record<string, unknown>;
};
export type AddCourseEnrollmentResponse = {
    enrollment: CourseEnrollmentRecord;
};
export type UpdateCourseEnrollmentRequest = {
    status: "enrolled" | "waitlist" | "cancelled" | "completed";
};
export type UpdateCourseEnrollmentResponse = {
    enrollment: CourseEnrollmentRecord;
};
