import type { AppointmentBookingQuestionsTask } from "./bookingOperations";
import type { SiteRole } from "./siteMembers";
/**
 * Site Operations Contracts
 *
 * These types cover admin-facing site operations and operational responses:
 * site-cost admin actions, dev-tools state, cron job summaries, site logs,
 * manual site scaffolding, and shop-order admin workflows.
 *
 * Note: Do NOT use these API types as validation schemas. They document wire
 * contracts while the owning services remain responsible for validation.
 */
export type AuthStatusResponse = {
    authenticated: true;
    keyType: "content" | "preview" | "management" | (string & {});
    siteId: string;
    keyPrefix: string;
};
export type PortalAppointmentReschedule = {
    kind: "available";
    cutoffAt: string;
} | {
    kind: "unavailable";
    reason: "appointments_disabled" | "missing_service" | "not_future" | "cutoff_passed";
    cutoffAt: string | null;
};
export type PortalAppointmentWithDetails = {
    id: string;
    serviceId: string;
    serviceName: string;
    resourceId: string | null;
    resourceName: string | null;
    customerName: string;
    customerEmail: string;
    startAt: string;
    endAt: string;
    status: string;
    notes?: string | null;
    createdAt: string;
    beforeYouCome: AppointmentBookingQuestionsTask | null;
    cancellation: {
        canCancel: boolean;
        canAutoRefundOnCancel: boolean;
        refundCutoffAt: string | null;
    };
    reschedule: PortalAppointmentReschedule;
    rebook: {
        kind: "available";
    } | {
        kind: "unavailable";
        reason: "appointments_disabled" | "upcoming" | "missing_service";
    };
};
export type AccountRevokeSessionsBody = {
    scope?: "others" | "global";
};
export type AccountRevokeSessionsResponse = {
    ok: boolean;
    scope: "others" | "global";
};
export type AccountUpdatePasswordBody = {
    currentPassword?: string | null;
    newPassword: string;
};
export type AccountUpdatePasswordResponse = {
    ok: boolean;
    passwordSetAt?: string | null;
};
export type AdminSiteCostResponse = {
    site: {
        id: string;
        name: string;
        monthlyCostCents: number;
        billingStartsAt: string | null;
        formattedCost: string;
    };
    owner: {
        userId: string;
        email: string;
    } | null;
    history: Array<{
        id: string;
        previousCostCents: number;
        newCostCents: number;
        changedBy: string;
        reason: string | null;
        createdAt: string;
        formattedPreviousCost: string;
        formattedNewCost: string;
    }>;
};
export type AdminUpdateSiteCostRequest = {
    monthlyCostCents: number;
    billingStartsAt?: string | null;
    reason?: string;
};
export type AdminSiteCostUpdateSyncResult = {
    status: "not_applicable";
    message: null;
} | {
    status: "updated";
    message: null;
} | {
    status: "unchanged";
    message: null;
} | {
    status: "failed";
    message: string;
};
export type AdminUpdateSiteCostResponse = AdminSiteCostResponse & {
    subscriptionSync: AdminSiteCostUpdateSyncResult;
};
export type ListGscPropertiesAdminResponse = {
    properties: Array<{
        id: string;
        siteId: string;
        siteUrl: string;
        type: "domain" | "url_prefix";
        verificationMethod: string | null;
        verificationToken: string | null;
        verifiedAt: string | null;
        status: string;
        firstSeenDate: string | null;
        lastSyncedDate: string | null;
        persistEnabled: boolean;
        createdAt: string;
        updatedAt: string;
    }>;
};
export type DevToolsImpersonationResponse = {
    userId: string;
    email: string | null;
    mode: "superadmin" | "random";
};
export type DevToolsSeedResponse = {
    summary: {
        usersCreated: number;
        usersUpdated: number;
        sitesCreated: number;
        sitesUpdated: number;
        pagesCreated: number;
        pagesUpdated: number;
        blocksCreated: number;
    };
};
export type DowngradeRole = Extract<SiteRole, "administrator" | "editor" | "event_host">;
export type RoleDowngradeActualRole = Extract<SiteRole, "owner" | "administrator"> | null;
export type SiteRoleDowngradeState = {
    kind: "off";
    actualRole: RoleDowngradeActualRole;
} | {
    kind: "on";
    actualRole: RoleDowngradeActualRole;
    siteId: string;
    role: DowngradeRole;
};
export type DevToolsGetSiteRoleDowngradeQuery = {
    siteId: string;
};
export type DevToolsSetSiteRoleDowngradeRequest = {
    siteId: string;
    role: DowngradeRole | null;
};
export type CronEventRemindersResponse = {
    success: true;
    sent: number;
    failed: number;
    errors: Array<{
        attendeeId: string;
        error: string;
    }>;
};
export type CronEventFeedbackEmailsResponse = {
    success: true;
    sent: number;
    failed: number;
    skipped: number;
    errors: Array<{
        sourceType: "event" | "course";
        sourceId: string;
        error: string;
    }>;
};
export type CronEventOccurrencesResponse = {
    success: true;
    seriesProcessed: number;
    occurrencesCreated: number;
    errors: Array<{
        seriesId: string;
        error: string;
    }>;
};
export type CronAppointmentRemindersResponse = {
    success: true;
    sent: number;
    failed: number;
    errors: Array<{
        appointmentId: string;
        error: string;
    }>;
};
export type CronNewsletterSendResponse = {
    ok: true;
    enqueue: {
        enqueued: number;
        skipped: number;
        failed: number;
    };
    claimed: number;
    processed: number;
    completed: number;
    failed: number;
};
export type CronBillingStatusResponse = {
    success: true;
    checked: number;
    sent: number;
    skipped: number;
    errors?: string[];
};
export type CronMediaJobsQuery = {
    maxSites?: number;
    maxSteps?: number;
    siteIds?: string[];
};
export type CronMediaJobsResponse = {
    ok: true;
    results: Array<{
        siteId: string;
        jobId: string | null;
        status: "skipped" | "completed" | "processing";
        summary?: {
            processed: number;
            skipped: number;
            failures: number;
        };
        tokensEstimated?: number;
    }>;
};
export type CronPaymentReconciliationResponse = {
    success: true;
    olderThanMinutes: number;
    cutoffIso: string;
    attendees: {
        checked: number;
        updated: number;
        failed: number;
        skipped: number;
    };
    courseEnrollments: {
        checked: number;
        updated: number;
        failed: number;
        skipped: number;
    };
    subscriptions: {
        checked: number;
        updated: number;
        failed: number;
        skipped: number;
    };
    errors?: string[];
};
export type CronWaitlistExpiryResponse = {
    processed: number;
    expired: number;
    skipped: number;
    capacityEffectsGenerated: number;
    recoveredSubjectsChecked: number;
};
export type CronSeoIngestResponse = {
    ok: true;
    startedAt: string;
    processed: number;
    updatedMeta: number;
    seededReports: number;
    skipped: number;
    apiRequests: number;
    throttledMs: number;
    inspectionSamples: number;
};
export type SiteInvitee = {
    email: string;
    role: "editor" | "administrator";
};
export type CreateManualSiteRequest = {
    title: string;
    deploymentMode?: "managed" | "headless_full";
    description?: string | null;
    themeKey?: string;
    contentTypes?: Array<"page" | "post" | "event" | "testimonial" | "team-member">;
    scaffoldHome?: boolean;
    scaffoldContact?: boolean;
    scaffoldBlog?: boolean;
    invitees?: SiteInvitee[];
    userId?: string;
};
export type CreateManualSiteResponse = {
    siteId: string;
    slug: string;
    seeded: {
        pages: Array<{
            id: string;
            name: string;
            path: string;
        }>;
        forms: Array<{
            id: string;
            name: string;
            slug: string;
        }>;
        contentTypes: Array<"page" | "post" | "event" | "testimonial" | "team-member">;
    };
    invitations?: {
        sent: number;
        failed: number;
    };
};
export type SiteLogActor = {
    id: string;
    displayName: string | null;
    avatarUrl: string | null;
};
export type SiteContentActivityLogEntry = {
    id: string;
    timestamp: string;
    kind: "page" | "content_entry";
    label: string;
    subtitle: string;
    href: string | null;
    actor: SiteLogActor | null;
};
export type SiteFormSubmissionActivityLogEntry = {
    id: string;
    timestamp: string;
    kind: "form_submission";
    label: string;
    subtitle: string;
    href: string | null;
    actor: null;
};
export type SiteActivityLogEntry = SiteContentActivityLogEntry | SiteFormSubmissionActivityLogEntry;
export type ListSiteActivityLogsResponse = {
    entries: SiteActivityLogEntry[];
    nextCursor: string | null;
};
import type { StaffCancellationContextInput } from "./common/cancellation";
export { STAFF_CANCELLATION_CONTEXT_CATEGORIES, STAFF_CANCELLATION_CONTEXT_UI_CATEGORIES, } from "./common/cancellation";
export type { StaffCancellationContextCategory, StaffCancellationContextInput, StaffCancellationContextUiCategory, } from "./common/cancellation";
export type SiteEmailLogEntry = {
    id: string;
    createdAt: string;
    sentAt: string | null;
    status: string;
    transport: string;
    subject: string;
    providerMessageId: string | null;
    recipientTo: string[];
    recipientCc: string[];
    recipientBcc: string[];
    error: string | null;
};
export type ListSiteEmailLogsResponse = {
    entries: SiteEmailLogEntry[];
    nextCursor: string | null;
};
export type SiteEmailEventLogEntry = {
    id: string;
    createdAt: string;
    eventType: string;
    provider: string;
    providerEventId: string | null;
};
export type ListSiteEmailEventLogsResponse = {
    entries: SiteEmailEventLogEntry[];
};
export type SitePublicErrorLogEntry = {
    timestamp: string;
    severity: "debug" | "info" | "warn" | "error" | "unknown";
    event: string;
    path: string | null;
    statusCode: number | null;
};
export type ListSitePublicErrorLogsResponse = {
    entries: SitePublicErrorLogEntry[];
};
export type RefundShopOrderResponse = {
    status: "succeeded" | "partially_succeeded" | "failed";
    currency: string;
    refundedAmountCents: number;
    itemResults: ReadonlyArray<{
        orderItemId: string;
        displayName: string;
        status: "succeeded" | "failed";
        amountCents: number | null;
        errorMessage?: string;
    }>;
};
export type CreateOrderShipmentRequest = {
    items: Array<{
        orderItemId: string;
        quantity: number;
    }>;
    trackingUrl?: string | null;
    carrierName?: string | null;
    notes?: string | null;
};
export type CreateOrderShipmentResponse = {
    shipmentId: string;
    itemCount: number;
};
export type LegacyStaffCancellationRequest = {
    reason?: string | null;
};
export type CancelShopOrderRequest = {
    cancellation: StaffCancellationContextInput;
} | LegacyStaffCancellationRequest;
export type CancelShopOrderResponse = {
    refundResult: RefundShopOrderResponse | null;
    cancelledItemCount: number;
};
export type CancelShopOrderItemRequest = {
    cancellation: StaffCancellationContextInput;
} | LegacyStaffCancellationRequest;
export type CancelShopOrderItemResponse = {
    orderFullyCancelled: boolean;
};
export type EditShopOrderAddressRequest = {
    shippingAddress: {
        name: string | null;
        line1: string | null;
        line2: string | null;
        city: string | null;
        state: string | null;
        postalCode: string | null;
        country: string | null;
    };
};
export type ShopOrderDigitalFulfillmentRequest = {
    entitlementId: string;
    action: "resend" | "grant" | "revoke";
};
export declare const FLEXIBLE_BALANCE_ADMIN_ACTION_SOURCES: readonly ["order_detail", "payment_issues_queue", "appointment_detail", "event_attendee_detail", "course_enrollment_detail"];
export type FlexibleBalanceAdminActionSource = (typeof FLEXIBLE_BALANCE_ADMIN_ACTION_SOURCES)[number];
export type CancelFlexibleBalanceBookingDueToNonPaymentRequest = {
    cancellation: StaffCancellationContextInput;
    source: FlexibleBalanceAdminActionSource;
} | {
    reason: string;
    source: FlexibleBalanceAdminActionSource;
};
export type ReopenFlexibleBalanceBookingAfterNonPaymentCancellationRequest = {
    source: FlexibleBalanceAdminActionSource;
};
export type FlexibleBalanceAdminActionResponse = {
    action: "cancelled" | "reopened";
    flexibleBalanceStatus: "cancelled_due_to_non_payment" | "overdue";
    orderItemId: string;
};
export type CreateShopOrderPaymentLinkResponse = {
    paymentLink: string;
};
export type SendShopOrderPaymentReminderResponse = {
    jobId: string;
    status: "sent" | "queued" | "duplicate";
    recipientEmail: string;
};
export type SettleShopOrderPaymentRequest = {
    action: "mark_paid" | "mark_waived" | "record_partial_payment";
    amountCents?: number | null;
    externalReference?: string | null;
    note?: string | null;
};
export type SettleShopOrderPaymentResponse = {
    status: "pending" | "paid";
    paymentMethod: "manual" | "waived" | "stripe" | "mixed";
    remainingBalanceCents: number;
    flexibleBalanceStatus?: "active" | "overdue" | "completed" | "waived";
};
