# Installation

## Database Installation

{% hint style="info" %}
Before you install you have option on config.lua `Config.AutoDatabase` to run the database automatic.
{% endhint %}

```sql
CREATE TABLE IF NOT EXISTS `m_citations` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(50) NOT NULL,
  `player_name` varchar(100) NOT NULL,
  `officer_name` varchar(100) NOT NULL,
  `officer_callsign` varchar(20) DEFAULT NULL,
  `officer_citizenid` varchar(50) NOT NULL,
  `department` varchar(50) NOT NULL,
  `issuing_officer_job` varchar(50) DEFAULT NULL,
  `violation` varchar(100) NOT NULL,
  `fine_amount` int(11) NOT NULL,
  `original_amount` int(11) DEFAULT NULL,
  `insurance_status` tinyint(1) DEFAULT 0,
  `discount_percentage` int(11) DEFAULT 0,
  `street_name` varchar(100) DEFAULT NULL,
  `vehicle_model` varchar(50) DEFAULT NULL,
  `license_plate` varchar(20) DEFAULT NULL,
  `additional_comments` text DEFAULT NULL,
  `evidence_photo` text DEFAULT NULL,
  `status` enum('pending','paid','overdue') DEFAULT 'pending',
  `issued_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `paid_date` timestamp NULL DEFAULT NULL,
  `due_date` timestamp NOT NULL DEFAULT (current_timestamp() + interval 30 day),
  PRIMARY KEY (`id`),
  KEY `idx_citizenid` (`citizenid`),
  KEY `idx_status` (`status`),
  KEY `idx_department` (`department`),
  KEY `idx_issuing_officer_job` (`issuing_officer_job`),
  KEY `idx_due_date` (`due_date`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `m_citations_fine_payments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fine_id` int(11) NOT NULL,
  `citizenid` varchar(50) NOT NULL,
  `amount_paid` int(11) NOT NULL,
  `payment_method` varchar(50) DEFAULT 'cash',
  `payment_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `paid_at_station` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_fine_id` (`fine_id`),
  KEY `idx_citizenid` (`citizenid`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```

## Item Installation

{% tabs %}
{% tab title="qb-inventory" %}

```lua
citation = { name = 'citation', label = 'Traffic Citation', weight = 100, type = 'item', image = 'citation.png', unique = true, useable = false, shouldClose = true, description = '' },
```

{% endtab %}

{% tab title="ox\_inventory" %}

```lua
['citation'] = {
    label = 'Traffic Citation',
    weight = 1,
    stack = false,
    close = false,
},
```

{% endtab %}
{% endtabs %}
