Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace App\Http\Repositories\interfaces;
4
5use App\Http\Models\AIPrompts;
6use Illuminate\Support\Collection;
7
8/**
9 * Interface for AI prompt data access operations.
10 *
11 * This repository abstracts AI prompt-related database queries,
12 * providing methods to manage AI prompt configurations used by
13 * FlyRewrite, FlyPost, and other AI features.
14 */
15interface IAIPromptRepository
16{
17    /**
18     * Get all AI prompts ordered by newest first, with optional product filtering.
19     *
20     * @param  string|null  $product  Optional product to filter by (paragraph_rewrite, sentence_rewrite, fly_post, watch_youtube)
21     * @return Collection<int, AIPrompts> Collection of AI prompts
22     */
23    public function getAll(?string $product = null): Collection;
24
25    /**
26     * Find an AI prompt by its ID.
27     *
28     * @param  string  $id  The AI prompt ID
29     * @return AIPrompts|null The AI prompt or null if not found
30     */
31    public function findById(string $id): ?AIPrompts;
32
33    /**
34     * Get the latest version of an AI prompt by product and name.
35     *
36     * @param  string  $product  The product identifier
37     * @param  string  $name  The prompt name/action
38     * @return AIPrompts|null The latest version or null if not found
39     */
40    public function getLatestByProductAndName(string $product, string $name): ?AIPrompts;
41
42    /**
43     * Create a new AI prompt.
44     *
45     * @param  array{
46     *     product: string,
47     *     name: string,
48     *     model?: string|null,
49     *     version?: int,
50     *     temperature?: float|null,
51     *     tokens?: int|null,
52     *     top_p?: float|null,
53     *     mission?: string|null,
54     *     context?: string|null,
55     *     persona?: string|null,
56     *     instructions?: array<string>|null,
57     *     examples?: array<array{input: string, output: string}>|null,
58     *     constraints?: array<string>|null,
59     *     output_instructions?: array<string>|null,
60     *     threshold?: float|null,
61     *     is_grounding?: bool|null,
62     *     include_hashtags_prompt?: string|null,
63     *     exclude_hashtags_prompt?: string|null,
64     *     include_emojis_prompt?: string|null,
65     *     exclude_emojis_prompt?: string|null,
66     *     existent_content_instructions?: string|null,
67     *     existent_content_constraints?: array<string>|null,
68     *     youtube_url_mission?: string|null,
69     *     blog_url_mission?: string|null,
70     *     youtube_url_instructions?: array<string>|null,
71     *     blog_url_instructions?: array<string>|null
72     * }  $data  The AI prompt data
73     * @return AIPrompts The created AI prompt
74     */
75    public function create(array $data): AIPrompts;
76
77    /**
78     * Update an existing AI prompt.
79     *
80     * @param  AIPrompts  $aiPrompt  The AI prompt to update
81     * @param  array{
82     *     product?: string,
83     *     name?: string,
84     *     model?: string|null,
85     *     version?: int,
86     *     temperature?: float|null,
87     *     tokens?: int|null,
88     *     top_p?: float|null,
89     *     mission?: string|null,
90     *     context?: string|null,
91     *     persona?: string|null,
92     *     instructions?: array<string>|null,
93     *     examples?: array<array{input: string, output: string}>|null,
94     *     constraints?: array<string>|null,
95     *     output_instructions?: array<string>|null,
96     *     threshold?: float|null,
97     *     is_grounding?: bool|null,
98     *     include_hashtags_prompt?: string|null,
99     *     exclude_hashtags_prompt?: string|null,
100     *     include_emojis_prompt?: string|null,
101     *     exclude_emojis_prompt?: string|null,
102     *     existent_content_instructions?: string|null,
103     *     existent_content_constraints?: array<string>|null,
104     *     youtube_url_mission?: string|null,
105     *     blog_url_mission?: string|null,
106     *     youtube_url_instructions?: array<string>|null,
107     *     blog_url_instructions?: array<string>|null
108     * }  $data  The update data
109     * @return AIPrompts The updated AI prompt
110     */
111    public function update(AIPrompts $aiPrompt, array $data): AIPrompts;
112
113    /**
114     * Delete an AI prompt.
115     *
116     * @param  AIPrompts  $aiPrompt  The AI prompt to delete
117     * @return bool True if deleted successfully
118     */
119    public function delete(AIPrompts $aiPrompt): bool;
120}