# Sub Dictionary: `tbl_Coupons`

## Table Info

| Property | Value |
|----------|-------|
| Table | `tbl_Coupons` |
| Database | quitsure |
| Connection | `mysql` |
| Engine | InnoDB |
| Type | TABLE |
| Category | Coupon/Voucher |
| Laravel Model | `Coupon` (app/Models/Coupon.php) |

## Columns

| # | Column | Type | Nullable | Default | Key | Extra | Description |
|---|--------|------|----------|---------|-----|-------|-------------|
| 1 | `iCouponId` | `int unsigned` | NO | - | PRI | auto_increment | Integer: Coupon Id (likely FK) |
| 2 | `vCode` | `varchar(45)` | NO | - | MUL | - | Varchar: Code |
| 3 | `vDescription` | `varchar(500)` | YES | NULL | - | - | Varchar: Description |
| 4 | `vMessage` | `varchar(1000)` | NO | - | - | - | Varchar: Message |
| 5 | `iCountLeft` | `int unsigned` | NO | `0` | MUL | - | Integer: Count Left |
| 6 | `iCountUsed` | `int unsigned` | NO | `0` | MUL | - | Integer: Count Used |
| 7 | `iUserId` | `int unsigned` | YES | NULL | MUL | - | Integer: User Id (likely FK) |
| 8 | `vRecipientEmail` | `varchar(500)` | YES | NULL | MUL | - | Varchar: Recipient Email |
| 9 | `dValidTill` | `datetime` | YES | NULL | MUL | - | Datetime: Valid Till |
| 10 | `dDateCreated` | `datetime` | NO | `CURRENT_TIMESTAMP` | - | DEFAULT_GENERATED | Datetime: Date Created |
| 11 | `bUsed` | `tinyint` | NO | `0` | MUL | - | Boolean/Flag: Used |
| 12 | `iProgramId` | `int unsigned` | NO | - | MUL | - | Integer: Program Id (likely FK) |
| 13 | `vRecipientDomain` | `varchar(500)` | YES | NULL | - | - | Varchar: Recipient Domain |
| 14 | `iDiscount` | `int unsigned` | YES | `0` | - | - | Integer: Discount |
| 15 | `iCouponTypeId` | `int unsigned` | NO | `1` | - | - | Integer: Coupon Type Id (likely FK) |
| 16 | `iPartnerId` | `int unsigned` | YES | NULL | - | - | Integer: Partner Id (likely FK) |
| 17 | `vIOSCustomCodeId` | `varchar(100)` | YES | NULL | - | - | Varchar: IOS Custom Code Id |

## Indexes

| Name | Columns | Unique | Type |
|------|---------|--------|------|
| `idx_tbl_coupons_bUsed` | `bUsed` | NO | BTREE |
| `idx_tbl_coupons_dValidTill` | `dValidTill` | NO | BTREE |
| `idx_tbl_coupons_iCountLeft` | `iCountLeft` | NO | BTREE |
| `idx_tbl_coupons_iCountUsed` | `iCountUsed` | NO | BTREE |
| `idx_tbl_coupons_iProgramId` | `iProgramId` | NO | BTREE |
| `idx_tbl_coupons_iUserId` | `iUserId` | NO | BTREE |
| `idx_tbl_coupons_vCode_iProgramId` | `vCode`, `iProgramId` | YES | BTREE |
| `idx_tbl_coupons_vRecipientEmail` | `vRecipientEmail` | NO | BTREE |
| `PRIMARY` | `iCouponId` | YES | BTREE |

## Foreign Keys

### Formal Foreign Keys

None defined.

### Implicit Relationships (from column naming)

| Column | Likely References |
|--------|------------------|
| `iUserId` | `tbl_Users.iUserID` |
| `iProgramId` | `tbl_Programs.iProgramID` |
| `iCouponTypeId` | `tbl_CouponTypes.iCouponTypeId` |
| `iPartnerId` | `tbl_Partners.iPartnerId` |

## Laravel Eloquent Relationships

| Method | Type | Related Model | Foreign Key |
|--------|------|--------------|-------------|
| `couponType()` | belongsTo | `CouponType` | `iCouponTypeId` |
| `partner()` | belongsTo | `Partner` | `iPartnerId` |
