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\Feature;
6use Illuminate\Support\Collection;
7
8/**
9 * Interface for feature data access operations.
10 *
11 * This repository abstracts feature-related database queries,
12 * providing methods to manage the master list of features.
13 */
14interface IFeatureRepository
15{
16    /**
17     * Get all features with optional category filtering.
18     *
19     * @param  string|null  $category  Optional category to filter by
20     * @return Collection<int, Feature> Collection of features
21     */
22    public function getAll(?string $category = null): Collection;
23
24    /**
25     * Get all active features ordered by display order.
26     *
27     * @param  string|null  $category  Optional category to filter by
28     * @return Collection<int, Feature> Collection of active features
29     */
30    public function getAllActive(?string $category = null): Collection;
31
32    /**
33     * Find a feature by its ID.
34     *
35     * @param  string  $id  The feature ID
36     * @return Feature|null The feature or null if not found
37     */
38    public function findById(string $id): ?Feature;
39
40    /**
41     * Find a feature by its key.
42     *
43     * @param  string  $key  The feature key
44     * @return Feature|null The feature or null if not found
45     */
46    public function findByKey(string $key): ?Feature;
47
48    /**
49     * Create a new feature.
50     *
51     * @param  array{
52     *     key: string,
53     *     name: string,
54     *     description?: string|null,
55     *     value_type: string,
56     *     category: string,
57     *     default_value?: mixed,
58     *     is_active?: bool,
59     *     display_order?: int
60     * }  $data  The feature data
61     * @return Feature The created feature
62     */
63    public function create(array $data): Feature;
64
65    /**
66     * Update an existing feature.
67     *
68     * @param  Feature  $feature  The feature to update
69     * @param  array{
70     *     key?: string,
71     *     name?: string,
72     *     description?: string|null,
73     *     value_type?: string,
74     *     category?: string,
75     *     default_value?: mixed,
76     *     is_active?: bool,
77     *     display_order?: int
78     * }  $data  The update data
79     * @return Feature The updated feature
80     */
81    public function update(Feature $feature, array $data): Feature;
82
83    /**
84     * Delete a feature.
85     *
86     * @param  Feature  $feature  The feature to delete
87     * @return bool True if deleted successfully
88     */
89    public function delete(Feature $feature): bool;
90}