/**
 * Patterns Service
 *
 * Provides data access methods for patterns.
 * Patterns is a team-scoped entity (shared: true) - all team members see the same patterns.
 *
 * All methods require authentication and use RLS with team isolation.
 *
 * @module PatternsService
 */
import type { Pattern, CreatePatternInput, UpdatePatternInput, PatternListOptions, PatternListResult } from './patterns.types';
export declare class PatternsService {
    /**
     * Get a pattern by ID
     *
     * Respects RLS policies. Since patterns has shared: true,
     * all team members can access patterns from their team.
     *
     * @param id - Pattern ID
     * @param userId - Current user ID for RLS
     * @returns Pattern data or null if not found/not authorized
     *
     * @example
     * const pattern = await PatternsService.getById('pattern-uuid', currentUserId)
     */
    static getById(id: string, userId: string): Promise<Pattern | null>;
    /**
     * Get a pattern by slug and team ID
     *
     * @param slug - Pattern slug
     * @param teamId - Team ID
     * @param userId - Current user ID for RLS
     * @returns Pattern data or null if not found
     *
     * @example
     * const pattern = await PatternsService.getBySlug('newsletter-cta', teamId, userId)
     */
    static getBySlug(slug: string, teamId: string, userId: string): Promise<Pattern | null>;
    /**
     * List patterns with pagination and filtering
     *
     * @param userId - Current user ID for RLS
     * @param teamId - Team ID
     * @param options - List options (limit, offset, status, orderBy, orderDir)
     * @returns Object with patterns array and total count
     *
     * @example
     * const { data, total } = await PatternsService.list(userId, teamId, {
     *   status: 'published',
     *   limit: 10
     * })
     */
    static list(userId: string, teamId: string, options?: PatternListOptions): Promise<PatternListResult>;
    /**
     * List only published patterns for a team
     *
     * Convenience method to fetch all published patterns.
     * Used by the block picker to show available patterns for insertion.
     *
     * @param userId - Current user ID for RLS
     * @param teamId - Team ID
     * @returns Array of published patterns
     *
     * @example
     * const publishedPatterns = await PatternsService.listPublished(userId, teamId)
     */
    static listPublished(userId: string, teamId: string): Promise<Pattern[]>;
    /**
     * Get multiple patterns by IDs (batch fetch)
     *
     * Used for resolving pattern references in pages.
     * Efficiently fetches all referenced patterns in a single query.
     *
     * @param ids - Array of pattern IDs
     * @param userId - Current user ID for RLS
     * @returns Array of patterns (may be fewer than ids if some not found)
     *
     * @example
     * const patternRefs = [{ ref: 'uuid-1' }, { ref: 'uuid-2' }]
     * const patterns = await PatternsService.getByIds(
     *   patternRefs.map(p => p.ref),
     *   userId
     * )
     */
    static getByIds(ids: string[], userId: string): Promise<Pattern[]>;
    /**
     * Create a new pattern
     *
     * @param userId - Current user ID (will be pattern owner)
     * @param teamId - Team ID (pattern belongs to team)
     * @param data - Pattern data
     * @returns Created pattern
     *
     * @example
     * const pattern = await PatternsService.create(userId, teamId, {
     *   title: 'Newsletter CTA',
     *   slug: 'newsletter-cta',
     *   blocks: [...],
     *   status: 'draft'
     * })
     */
    static create(userId: string, teamId: string, data: CreatePatternInput): Promise<Pattern>;
    /**
     * Update an existing pattern
     *
     * @param id - Pattern ID
     * @param userId - Current user ID for RLS
     * @param data - Pattern data to update
     * @returns Updated pattern
     *
     * @example
     * const pattern = await PatternsService.update('pattern-id', userId, {
     *   title: 'Updated Title',
     *   status: 'published'
     * })
     */
    static update(id: string, userId: string, data: UpdatePatternInput): Promise<Pattern>;
    /**
     * Delete a pattern
     *
     * Uses "Lazy Cleanup" strategy: patterns can be deleted even if in use.
     * - ON DELETE CASCADE cleans up pattern_usages
     * - Orphaned PatternReferences in entities are filtered out on next save
     * - Public rendering gracefully skips missing patterns
     *
     * @param id - Pattern ID
     * @param userId - Current user ID for RLS
     * @returns True if deleted successfully
     *
     * @example
     * await PatternsService.delete('pattern-id', userId)
     */
    static delete(id: string, userId: string): Promise<boolean>;
}
//# sourceMappingURL=patterns.service.d.ts.map