/**
 * Hook type utilities and type predicates.
 *
 * This module provides:
 * - Generic hook result types with default type parameters
 * - Type predicates for query state narrowing
 * - Reusable patterns for type-safe property access in hooks
 *
 * Following generics best practices:
 * - generics-default-type-parameters: Default E to Error for common case
 * - generics-type-predicates: Type predicates for result state narrowing
 * - generics-constrain-type-parameters: K extends keyof T for property access
 */
/**
 * Base result type for query hooks with default error type.
 * Uses default type parameter for E (generics-default-type-parameters rule).
 *
 * @typeParam T - The data type
 * @typeParam E - The error type (defaults to Error)
 *
 * @example
 * // Error type defaults to Error
 * type UsersResult = QueryResult<User[]>;
 *
 * // Can override when needed
 * type CustomResult = QueryResult<User[], ApiError>;
 */
export interface QueryResult<T, E = Error> {
    readonly data: T;
    readonly isLoading: boolean;
    readonly isError: boolean;
    readonly error?: E | undefined;
}
/**
 * Result type for hooks that may not have data yet.
 * Extends QueryResult with nullable data.
 *
 * @typeParam T - The data type
 * @typeParam E - The error type (defaults to Error)
 */
export interface QueryResultNullable<T, E = Error> {
    readonly data: T | null | undefined;
    readonly isLoading: boolean;
    readonly isError: boolean;
    readonly error?: E | undefined;
}
/**
 * Result type for list/collection hooks with aggregates.
 *
 * @typeParam T - The item type in the array
 * @typeParam E - The error type (defaults to Error)
 */
export interface ListQueryResult<T, E = Error> extends QueryResult<T[], E> {
    readonly totalCount: number;
}
/**
 * Result type for list hooks with value aggregation (e.g., deals with total value).
 *
 * @typeParam T - The item type in the array
 * @typeParam E - The error type (defaults to Error)
 */
export interface ValueListQueryResult<T, E = Error> extends ListQueryResult<T, E> {
    readonly totalValue: number;
}
/**
 * Type predicate to check if a query result has successfully loaded data.
 * Narrows the data type from T | null | undefined to T.
 *
 * @example
 * const result = useContact(id);
 * if (hasData(result)) {
 *   // TypeScript knows result.data is Contact, not Contact | null
 *   console.log(result.data.name);
 * }
 */
export declare function hasData<T, E = Error>(result: QueryResultNullable<T, E>): result is QueryResultNullable<T, E> & {
    readonly data: T;
};
/**
 * Type predicate to check if a query result is in loading state.
 * Useful for conditional rendering.
 *
 * @example
 * if (isLoading(result)) {
 *   return <Spinner />;
 * }
 */
export declare function isLoading<T, E = Error>(result: QueryResult<T, E> | QueryResultNullable<T, E>): boolean;
/**
 * Type predicate to check if a query result has an error.
 * Narrows to include the error property.
 *
 * @example
 * if (isErrorResult(result)) {
 *   console.error(result.error); // error is E, not undefined
 * }
 */
export declare function isErrorResult<T, E = Error>(result: QueryResult<T, E> | QueryResultNullable<T, E>): result is (QueryResult<T, E> | QueryResultNullable<T, E>) & {
    readonly isError: true;
    readonly error: E;
};
/**
 * Type predicate to check if a query result is in idle state (not loading, no error, has data).
 *
 * @example
 * if (isIdle(result)) {
 *   // Safe to access and render data
 * }
 */
export declare function isIdle<T, E = Error>(result: QueryResult<T, E> | QueryResultNullable<T, E>): boolean;
/**
 * Type-safe property selector for hook results.
 * Uses K extends keyof T constraint (generics-function-constraints rule).
 *
 * @typeParam T - The data object type
 * @typeParam K - Key of T (constrained to actual keys)
 *
 * @example
 * const users = [{ name: "Alice", age: 30 }];
 * const names = selectProperty(users, "name"); // string[]
 * const ages = selectProperty(users, "age");   // number[]
 * selectProperty(users, "invalid"); // Error: "invalid" not in "name" | "age"
 */
export declare function selectProperty<T, K extends keyof T>(items: readonly T[], key: K): T[K][];
/**
 * Type-safe property getter for a single item.
 * Returns undefined if item is null/undefined.
 *
 * @typeParam T - The data object type
 * @typeParam K - Key of T (constrained to actual keys)
 */
export declare function getProperty<T, K extends keyof T>(item: T | null | undefined, key: K): T[K] | undefined;
/**
 * Generic type for hooks that fetch a single resource by ID.
 * Useful for creating consistent API across different resource types.
 *
 * @typeParam T - The resource type
 * @typeParam E - The error type (defaults to Error)
 */
export type UseSingleResourceHook<T, E = Error> = (id: string) => QueryResultNullable<T, E>;
/**
 * Generic type for hooks that fetch a list of resources with optional params.
 * Uses generics-default-type-parameters for the params type.
 *
 * @typeParam T - The item type
 * @typeParam P - The params type (defaults to empty object)
 * @typeParam E - The error type (defaults to Error)
 */
export type UseListResourceHook<T, P extends Record<string, unknown> = Record<string, never>, E = Error> = (params?: P) => ListQueryResult<T, E>;
/**
 * Transforms a nullable result to a non-nullable one if data exists.
 * Useful when you've already checked hasData().
 */
export type WithData<R extends QueryResultNullable<unknown>> = R extends QueryResultNullable<infer T, infer E> ? QueryResultNullable<T, E> & {
    readonly data: T;
} : never;
/**
 * Activity slug constants as a const object.
 * Derive the ActivitySlug type from this single source of truth.
 */
export declare const ACTIVITY_SLUGS: {
    readonly abandonedCart: "abandoned_cart";
    readonly announcements: "announcements";
    readonly cartItemsAdded: "cart_items_added";
    readonly commentReply: "comment_reply";
    readonly directMessage: "direct_message";
    readonly fantasyPoint: "fantasy_point";
    readonly newLead: "new_lead";
    readonly orderPlaced: "order_placed";
    readonly pageViews: "page_views";
    readonly pageViewsContact: "page_views_contact";
    readonly tasks: "tasks";
    readonly upcomingEvent: "upcoming_event";
    readonly video: "video";
    readonly videoComplete: "video_complete";
    readonly videoCompleteContact: "video_complete_contact";
    readonly videoContact: "video_contact";
    readonly messageReceived: "message_received";
    readonly messageSent: "message_sent";
    readonly newCartItemsAdded: "new_cart_items_added";
    readonly smartLinkClicked: "smart_link_clicked";
    readonly reviewLeft: "review_left";
};
/** Activity slug union type derived from ACTIVITY_SLUGS constant. */
export type ActivitySlug = (typeof ACTIVITY_SLUGS)[keyof typeof ACTIVITY_SLUGS];
/** Type predicate to check if a string is a valid ActivitySlug. */
export declare function isActivitySlug(value: string): value is ActivitySlug;
/** Transformed activity for display. */
export interface Activity {
    readonly id: number;
    readonly userName: string;
    readonly avatarUrl: string | null;
    readonly activityType: string;
    readonly targetName: string;
    readonly timestamp: string;
    readonly slug: ActivitySlug;
}
/** Description/rich text metadata for a calendar event. */
export interface CalendarEventDescription {
    readonly id?: number | null;
    readonly name?: string | null;
    readonly body?: string | null;
    readonly record_type?: string | null;
    readonly record_id?: number | null;
    readonly created_at?: string | null;
    readonly updated_at?: string | null;
    readonly locale?: string | null;
}
/** Calendar event data from the API. */
export interface CalendarEvent {
    readonly id: number;
    readonly title: string;
    readonly description?: CalendarEventDescription | null;
    readonly color?: string | null;
    readonly url?: string | null;
    readonly start: string;
    readonly end: string;
    readonly active?: boolean | null;
    readonly time_zone?: string | null;
    readonly status?: string | null;
    readonly image_url?: string | null;
    readonly images?: readonly unknown[] | null;
    readonly venue?: string | null;
    readonly countries?: readonly string[] | null;
    readonly hasTomorrow?: boolean | null;
    readonly hasYesterday?: boolean | null;
    readonly isAllDay?: boolean;
}
/** Catch up suggestion data from the API. */
export interface CatchUp {
    readonly id: number;
    readonly suggestion_title: string;
}
/** MySite data returned by the hook. */
export interface MySiteData {
    readonly url: string | null;
    readonly views: number;
    readonly leads: number;
    readonly userName: string;
}
/** Transformed todo for display. */
export interface Todo {
    readonly id: number;
    readonly body: string;
    readonly dueAt: string | null;
    readonly completedAt: string | null;
    readonly createdAt: string;
    readonly contactName: string | null;
}
//# sourceMappingURL=hook-types.d.ts.map