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\Plans;
6use Illuminate\Contracts\Pagination\LengthAwarePaginator;
7use Illuminate\Support\Collection;
8
9/**
10 * Interface for plan data access operations.
11 *
12 * This repository abstracts plan-related database queries,
13 * providing methods to manage subscription plans.
14 */
15interface IPlanRepository
16{
17    /**
18     * Get all plans with optional filtering and pagination.
19     *
20     * @param  string|null  $filter  Optional search filter for plan titles
21     * @param  int  $perPage  Number of items per page
22     * @return LengthAwarePaginator<Plans>
23     */
24    public function getAllPaginated(?string $filter = null, int $perPage = 15): LengthAwarePaginator;
25
26    /**
27     * Get all active plans (where pricing_version is null).
28     *
29     * @return Collection<int, Plans> Collection of active plans
30     */
31    public function getAllActive(): Collection;
32
33    /**
34     * Find a plan by its ID.
35     *
36     * @param  string  $id  The plan ID
37     * @return Plans|null The plan or null if not found
38     */
39    public function findById(string $id): ?Plans;
40
41    /**
42     * Find a plan by its identifier.
43     *
44     * @param  string  $identifier  The plan identifier
45     * @return Plans|null The plan or null if not found
46     */
47    public function findByIdentifier(string $identifier): ?Plans;
48
49    /**
50     * Find a plan by its Stripe product ID.
51     *
52     * @param  string  $productId  The Stripe product ID
53     * @return Plans|null The plan or null if not found
54     */
55    public function findByStripeProductId(string $productId): ?Plans;
56
57    /**
58     * Get a plan with its features loaded.
59     *
60     * @param  string  $id  The plan ID
61     * @return Plans|null The plan with features or null if not found
62     */
63    public function getWithFeatures(string $id): ?Plans;
64
65    /**
66     * Create a new plan.
67     *
68     * @param  array<string, mixed>  $data  The plan data
69     * @return Plans The created plan
70     */
71    public function create(array $data): Plans;
72
73    /**
74     * Update an existing plan.
75     *
76     * @param  Plans  $plan  The plan to update
77     * @param  array<string, mixed>  $data  The update data
78     * @return Plans The updated plan
79     */
80    public function update(Plans $plan, array $data): Plans;
81
82    /**
83     * Delete a plan.
84     *
85     * @param  Plans  $plan  The plan to delete
86     * @return bool True if deleted successfully
87     */
88    public function delete(Plans $plan): bool;
89}