# Plans

Contains subscription plan data for a specific operator, including pricing models, 
configuration details, and subscription metrics. Filters plan information to show 
only plans associated with the specified operator either directly or through parent relationships.

**SQL:** `plans`

## Schema

| Column Name               | Data Type     | Description                                                                      |
|:--------------------------|:--------------|:---------------------------------------------------------------------------------|
| **Primary ID**            |               |                                                                                  |
| id                        | INTEGER       | Primary key                                                                      |
| **Other IDs**             |               |                                                                                  |
| country_id                | INTEGER       | Unique identifier for the country where the plan is available                    |
| operator_id               | INTEGER       | Unique identifier for the operator offering this plan                            |
| parent_operator_id        | INTEGER       | Unique identifier for the parent operator, if applicable                         |
| **Timestamps**            |               |                                                                                  |
| created_at                | TIMESTAMP_NTZ | Timestamp when the plan record was created                                       |
| updated_at                | TIMESTAMP_NTZ | Timestamp when the plan record was last modified                                 |
| deleted_at                | TIMESTAMP_NTZ | Timestamp when the plan was soft deleted, null if active                         |
| operator_deleted_at       | TIMESTAMP_NTZ | Timestamp when the operator associated with this plan was deleted                |
| **Attributes**            |               |                                                                                  |
| name                      | VARCHAR       | Display name of the subscription plan                                            |
| support_email             | VARCHAR       | Email address for customer support related to this plan                          |
| identifier                | VARCHAR       | Unique string identifier or code for the plan                                    |
| service                   | VARCHAR       | Type of service provided by this plan                                            |
| models                    | VARCHAR       | Supported device models or configurations for this plan                          |
| plan_for                  | VARCHAR       | Target audience or use case for this subscription plan                           |
| price_model               | VARCHAR       | Pricing structure type for the plan (e.g., per-unit, flat-rate, tiered)          |
| min_units                 | INTEGER       | Minimum number of units required for this subscription plan                      |
| contract_url              | VARCHAR       | URL to the contract or terms of service document                                 |
| active_subscription_count | INTEGER       | Current number of active subscriptions using this plan                           |
| prices_with_vat           | BOOLEAN       | Indicates whether the displayed prices include VAT (true) or exclude VAT (false) |

## Data inclusion criteria
This table works with `operator_id` or `parent_operator_id`must match the operator's ID.

## Data flow 
| Upstream tables | Downstream tables |
|:----------------|:------------------|
| ---             | ---               |

## Alignment
### Monta API
- Aligns with Monta API [get/plans](https://developer.monta.com/api/v1/plans) endpoint 
-
