# API Documentation

## Authentication

### Login
**Endpoint:** `POST /api/login`

**Request:**
```json
{
    "email": "company@example.com",
    "password": "password",
    "device_name": "My Device"
}
```

Note: The `device_name` field is optional and will default to the client's IP address if not provided.

**Response:**
```json
{
    "token": "your-api-token",
    "user": {
        "id": 1,
        "name": "Company User",
        "email": "company@example.com",
        "company_id": 1,
        "roles": ["company"]
    }
}
```

### Logout
**Endpoint:** `POST /api/logout`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "message": "Successfully logged out"
}
```

### Get User
**Endpoint:** `GET /api/user`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "user": {
        "id": 1,
        "name": "Company User",
        "email": "company@example.com",
        "company_id": 1,
        "roles": ["company"]
    }
}
```

## Company Events

### Get All Events
**Endpoint:** `GET /api/company/events`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "events": [
        {
            "id": 1,
            "company_id": 1,
            "name": "Demo Conference 2023",
            "description": "A demo conference for testing the QR code event management system.",
            "start_date": "2023-12-01T00:00:00.000000Z",
            "end_date": "2023-12-03T00:00:00.000000Z",
            "location": "Demo Convention Center",
            "address": "123 Demo Street",
            "city": "Demo City",
            "country": "Demo Country",
            "image": "images/demo-event.png",
            "is_active": true,
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z",
            "ticket_types": [
                {
                    "id": 1,
                    "event_id": 1,
                    "name": "VIP",
                    "description": "VIP access to all areas and sessions.",
                    "price": 199.99,
                    "quantity": 50,
                    "background_image": "images/vip-ticket.png",
                    "qrcode_position": "center",
                    "created_at": "2023-11-01T00:00:00.000000Z",
                    "updated_at": "2023-11-01T00:00:00.000000Z"
                }
            ]
        }
    ]
}
```

### Get Event Details
**Endpoint:** `GET /api/company/events/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "event": {
        "id": 1,
        "company_id": 1,
        "name": "Demo Conference 2023",
        "description": "A demo conference for testing the QR code event management system.",
        "start_date": "2023-12-01T00:00:00.000000Z",
        "end_date": "2023-12-03T00:00:00.000000Z",
        "location": "Demo Convention Center",
        "address": "123 Demo Street",
        "city": "Demo City",
        "country": "Demo Country",
        "image": "images/demo-event.png",
        "is_active": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "ticket_types": [
            {
                "id": 1,
                "event_id": 1,
                "name": "VIP",
                "description": "VIP access to all areas and sessions.",
                "price": 199.99,
                "quantity": 50,
                "background_image": "images/vip-ticket.png",
                "qrcode_position": "center",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            }
        ]
    }
}
```

### Get Event Attendees
**Endpoint:** `GET /api/company/events/{id}/attendees`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "event": {
        "id": 1,
        "company_id": 1,
        "name": "Demo Conference 2023",
        "description": "A demo conference for testing the QR code event management system.",
        "start_date": "2023-12-01T00:00:00.000000Z",
        "end_date": "2023-12-03T00:00:00.000000Z",
        "location": "Demo Convention Center",
        "address": "123 Demo Street",
        "city": "Demo City",
        "country": "Demo Country",
        "image": "images/demo-event.png",
        "is_active": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z"
    },
    "attendees": [
        {
            "id": 1,
            "event_id": 1,
            "ticket_type_id": 1,
            "name": "John Doe",
            "email": "john.doe@example.com",
            "phone": "1234567890",
            "qrcode": "550e8400-e29b-41d4-a716-446655440000",
            "is_attended": false,
            "email_sent": false,
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z",
            "ticket_type": {
                "id": 1,
                "event_id": 1,
                "name": "VIP",
                "description": "VIP access to all areas and sessions.",
                "price": 199.99,
                "quantity": 50,
                "background_image": "images/vip-ticket.png",
                "qrcode_position": "center",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            }
        }
    ],
    "verified_count": 0,
    "unverified_count": 1
}
```

### Create Event
**Endpoint:** `POST /api/company/events`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: multipart/form-data
```

**Request:**
```
name: Demo Conference 2023
description: A demo conference for testing the QR code event management system.
start_date: 2023-12-01
end_date: 2023-12-03
location: Demo Convention Center
address: 123 Demo Street
city: Demo City
country: Demo Country
image: [file upload]
ticket_types[0][name]: VIP
ticket_types[0][description]: VIP access to all areas and sessions.
ticket_types[0][price]: 199.99
ticket_types[0][quantity]: 50
ticket_types[0][background_image]: [file upload]
ticket_types[0][qrcode_position]: center
ticket_types[1][name]: Standard
ticket_types[1][description]: Standard access to main sessions.
ticket_types[1][price]: 99.99
ticket_types[1][quantity]: 200
ticket_types[1][background_image]: [file upload]
ticket_types[1][qrcode_position]: top_right
assigned_users[]: 3
assigned_users[]: 4
```

**Response:**
```json
{
    "message": "Event created successfully",
    "event": {
        "id": 2,
        "company_id": 1,
        "name": "Demo Conference 2023",
        "description": "A demo conference for testing the QR code event management system.",
        "start_date": "2023-12-01T00:00:00.000000Z",
        "end_date": "2023-12-03T00:00:00.000000Z",
        "location": "Demo Convention Center",
        "address": "123 Demo Street",
        "city": "Demo City",
        "country": "Demo Country",
        "image": "images/events/some-image.jpg",
        "is_active": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "ticket_types": [
            {
                "id": 4,
                "event_id": 2,
                "name": "VIP",
                "description": "VIP access to all areas and sessions.",
                "price": 199.99,
                "quantity": 50,
                "background_image": "images/tickets/some-image.jpg",
                "qrcode_position": "center",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            },
            {
                "id": 5,
                "event_id": 2,
                "name": "Standard",
                "description": "Standard access to main sessions.",
                "price": 99.99,
                "quantity": 200,
                "background_image": "images/tickets/some-image.jpg",
                "qrcode_position": "top_right",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            }
        ]
    }
}
```

### Assign Users to Event
**Endpoint:** `POST /api/company/events/{id}/users`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: application/json
```

**Request:**
```json
{
    "user_ids": [3, 4]
}
```

**Response:**
```json
{
    "message": "Users assigned to event successfully"
}
```

### Create Ticket Type
**Endpoint:** `POST /api/company/events/{id}/ticket-types`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: multipart/form-data
```

**Request:**
```
name: Basic
description: Basic access to selected sessions.
price: 49.99
quantity: 500
background_image: [file upload]
qrcode_position: bottom_left
```

**Response:**
```json
{
    "message": "Ticket type created successfully",
    "ticket_type": {
        "id": 6,
        "event_id": 1,
        "name": "Basic",
        "description": "Basic access to selected sessions.",
        "price": 49.99,
        "quantity": 500,
        "background_image": "images/tickets/some-image.jpg",
        "qrcode_position": "bottom_left",
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z"
    }
}
```

### Update Event
**Endpoint:** `PUT /api/company/events/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: multipart/form-data
```

**Request:**
```
name: Updated Event Name
description: Updated event description
start_date: 2023-12-15
end_date: 2023-12-17
location: Updated Location
address: Updated Address
city: Updated City
country: Updated Country
image: [file upload]
is_active: true
```

**Response:**
```json
{
    "message": "Event updated successfully",
    "event": {
        "id": 1,
        "company_id": 1,
        "name": "Updated Event Name",
        "description": "Updated event description",
        "start_date": "2023-12-15T00:00:00.000000Z",
        "end_date": "2023-12-17T00:00:00.000000Z",
        "location": "Updated Location",
        "address": "Updated Address",
        "city": "Updated City",
        "country": "Updated Country",
        "image": "images/events/some-image.jpg",
        "is_active": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "ticket_types": [
            {
                "id": 1,
                "event_id": 1,
                "name": "VIP",
                "description": "VIP access to all areas and sessions.",
                "price": 199.99,
                "quantity": 50,
                "background_image": "images/tickets/some-image.jpg",
                "qrcode_position": "center",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            }
        ]
    }
}
```

### Update Ticket Type
**Endpoint:** `PUT /api/company/events/{eventId}/ticket-types/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: multipart/form-data
```

**Request:**
```
name: Updated Ticket Type
description: Updated ticket type description
price: 59.99
quantity: 600
background_image: [file upload]
qrcode_position: top_right
```

**Response:**
```json
{
    "message": "Ticket type updated successfully",
    "ticket_type": {
        "id": 1,
        "event_id": 1,
        "name": "Updated Ticket Type",
        "description": "Updated ticket type description",
        "price": 59.99,
        "quantity": 600,
        "background_image": "images/tickets/some-image.jpg",
        "qrcode_position": "top_right",
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z"
    }
}
```

### Create Attendee
**Endpoint:** `POST /api/company/events/{id}/attendees`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: application/json
```

**Request:**
```json
{
    "ticket_type_id": 1,
    "name": "John Doe",
    "email": "john.doe@example.com",
    "phone": "1234567890"
}
```

**Response:**
```json
{
    "message": "Attendee created successfully",
    "attendee": {
        "id": 1,
        "event_id": 1,
        "ticket_type_id": 1,
        "name": "John Doe",
        "email": "john.doe@example.com",
        "phone": "1234567890",
        "qrcode": "550e8400-e29b-41d4-a716-446655440000",
        "is_attended": false,
        "email_sent": false,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "ticket_type": {
            "id": 1,
            "event_id": 1,
            "name": "VIP",
            "description": "VIP access to all areas and sessions.",
            "price": 199.99,
            "quantity": 50,
            "background_image": "images/tickets/some-image.jpg",
            "qrcode_position": "center",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z"
        }
    }
}
```

### Update Attendee
**Endpoint:** `PUT /api/company/attendees/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: application/json
```

**Request:**
```json
{
    "ticket_type_id": 2,
    "name": "Jane Doe",
    "email": "jane.doe@example.com",
    "phone": "0987654321"
}
```

**Response:**
```json
{
    "message": "Attendee updated successfully",
    "attendee": {
        "id": 1,
        "event_id": 1,
        "ticket_type_id": 2,
        "name": "Jane Doe",
        "email": "jane.doe@example.com",
        "phone": "0987654321",
        "qrcode": "550e8400-e29b-41d4-a716-446655440000",
        "is_attended": false,
        "email_sent": false,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "ticket_type": {
            "id": 2,
            "event_id": 1,
            "name": "Standard",
            "description": "Standard access to main sessions.",
            "price": 99.99,
            "quantity": 200,
            "background_image": "images/tickets/some-image.jpg",
            "qrcode_position": "top_right",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z"
        }
    }
}
```

### Delete Attendee
**Endpoint:** `DELETE /api/company/attendees/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "message": "Attendee deleted successfully"
}
```

## Admin API Endpoints

These endpoints are only accessible to users with the admin role.

### Get Dashboard Statistics
**Endpoint:** `GET /api/admin/dashboard`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "statistics": {
        "total_companies": 1,
        "total_events": 2,
        "total_users": 5
    }
}
```

### Company Management

#### Get All Companies
**Endpoint:** `GET /api/admin/companies`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "companies": [
        {
            "id": 1,
            "name": "Demo Company",
            "title_en": "Demo Company Inc.",
            "title_ar": "شركة تجريبية",
            "description_en": "This is a demo company for testing purposes.",
            "description_ar": "هذه شركة تجريبية لأغراض الاختبار.",
            "logo": "images/demo-logo.png",
            "profile_image": "images/demo-profile.png",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z",
            "users": [
                {
                    "id": 2,
                    "name": "Company User",
                    "email": "company@example.com",
                    "company_id": 1,
                    "phone": "0987654321",
                    "created_at": "2023-11-01T00:00:00.000000Z",
                    "updated_at": "2023-11-01T00:00:00.000000Z"
                }
            ]
        }
    ]
}
```

#### Get Company Details
**Endpoint:** `GET /api/admin/companies/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "company": {
        "id": 1,
        "name": "Demo Company",
        "title_en": "Demo Company Inc.",
        "title_ar": "شركة تجريبية",
        "description_en": "This is a demo company for testing purposes.",
        "description_ar": "هذه شركة تجريبية لأغراض الاختبار.",
        "logo": "images/demo-logo.png",
        "profile_image": "images/demo-profile.png",
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "users": [
            {
                "id": 2,
                "name": "Company User",
                "email": "company@example.com",
                "company_id": 1,
                "phone": "0987654321",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            }
        ]
    }
}
```

#### Create Company
**Endpoint:** `POST /api/admin/companies`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: multipart/form-data
```

**Request:**
```
name: New Company
title_en: New Company Inc.
title_ar: شركة جديدة
description_en: This is a new company.
description_ar: هذه شركة جديدة.
logo: [file upload]
profile_image: [file upload]
```

**Response:**
```json
{
    "message": "Company created successfully",
    "company": {
        "id": 2,
        "name": "New Company",
        "title_en": "New Company Inc.",
        "title_ar": "شركة جديدة",
        "description_en": "This is a new company.",
        "description_ar": "هذه شركة جديدة.",
        "logo": "images/companies/some-logo.jpg",
        "profile_image": "images/companies/some-profile.jpg",
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z"
    }
}
```

#### Update Company
**Endpoint:** `PUT /api/admin/companies/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: multipart/form-data
```

**Request:**
```
name: Updated Company
title_en: Updated Company Inc.
title_ar: شركة محدثة
description_en: This is an updated company.
description_ar: هذه شركة محدثة.
logo: [file upload]
profile_image: [file upload]
```

**Response:**
```json
{
    "message": "Company updated successfully",
    "company": {
        "id": 1,
        "name": "Updated Company",
        "title_en": "Updated Company Inc.",
        "title_ar": "شركة محدثة",
        "description_en": "This is an updated company.",
        "description_ar": "هذه شركة محدثة.",
        "logo": "images/companies/some-logo.jpg",
        "profile_image": "images/companies/some-profile.jpg",
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z"
    }
}
```

#### Delete Company
**Endpoint:** `DELETE /api/admin/companies/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "message": "Company deleted successfully"
}
```

### User Management

#### Get All Users
**Endpoint:** `GET /api/admin/users`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "users": [
        {
            "id": 1,
            "name": "Admin User",
            "email": "admin@example.com",
            "company_id": null,
            "phone": null,
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z",
            "roles": [
                {
                    "id": 1,
                    "name": "admin",
                    "guard_name": "web",
                    "created_at": "2023-11-01T00:00:00.000000Z",
                    "updated_at": "2023-11-01T00:00:00.000000Z",
                    "pivot": {
                        "model_id": 1,
                        "role_id": 1,
                        "model_type": "App\\Models\\User"
                    }
                }
            ],
            "company": null
        }
    ]
}
```

#### Get User Details
**Endpoint:** `GET /api/admin/users/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "user": {
        "id": 1,
        "name": "Admin User",
        "email": "admin@example.com",
        "company_id": null,
        "phone": null,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "roles": [
            {
                "id": 1,
                "name": "admin",
                "guard_name": "web",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z",
                "pivot": {
                    "model_id": 1,
                    "role_id": 1,
                    "model_type": "App\\Models\\User"
                }
            }
        ],
        "company": null
    }
}
```

#### Create User
**Endpoint:** `POST /api/admin/users`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: application/json
```

**Request:**
```json
{
    "name": "New User",
    "email": "newuser@example.com",
    "password": "password123",
    "role_id": 2,
    "company_id": 1,
    "phone": "1234567890"
}
```

**Response:**
```json
{
    "message": "User created successfully",
    "user": {
        "id": 6,
        "name": "New User",
        "email": "newuser@example.com",
        "company_id": 1,
        "phone": "1234567890",
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "roles": [
            {
                "id": 2,
                "name": "company",
                "guard_name": "web",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z",
                "pivot": {
                    "model_id": 6,
                    "role_id": 2,
                    "model_type": "App\\Models\\User"
                }
            }
        ],
        "company": {
            "id": 1,
            "name": "Demo Company",
            "title_en": "Demo Company Inc.",
            "title_ar": "شركة تجريبية",
            "description_en": "This is a demo company for testing purposes.",
            "description_ar": "هذه شركة تجريبية لأغراض الاختبار.",
            "logo": "images/demo-logo.png",
            "profile_image": "images/demo-profile.png",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z"
        }
    }
}
```

#### Update User
**Endpoint:** `PUT /api/admin/users/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: application/json
```

**Request:**
```json
{
    "name": "Updated User",
    "email": "updateduser@example.com",
    "password": "newpassword123",
    "role_id": 3,
    "company_id": 2,
    "phone": "0987654321"
}
```

**Response:**
```json
{
    "message": "User updated successfully",
    "user": {
        "id": 2,
        "name": "Updated User",
        "email": "updateduser@example.com",
        "company_id": 2,
        "phone": "0987654321",
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "roles": [
            {
                "id": 3,
                "name": "scanner",
                "guard_name": "web",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z",
                "pivot": {
                    "model_id": 2,
                    "role_id": 3,
                    "model_type": "App\\Models\\User"
                }
            }
        ],
        "company": {
            "id": 2,
            "name": "New Company",
            "title_en": "New Company Inc.",
            "title_ar": "شركة جديدة",
            "description_en": "This is a new company.",
            "description_ar": "هذه شركة جديدة.",
            "logo": "images/companies/some-logo.jpg",
            "profile_image": "images/companies/some-profile.jpg",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z"
        }
    }
}
```

#### Delete User
**Endpoint:** `DELETE /api/admin/users/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "message": "User deleted successfully"
}
```

### Event Management

#### Get All Events
**Endpoint:** `GET /api/admin/events`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "events": [
        {
            "id": 1,
            "company_id": 1,
            "name": "Demo Conference 2023",
            "description": "A demo conference for testing the QR code event management system.",
            "start_date": "2023-12-01T00:00:00.000000Z",
            "end_date": "2023-12-03T00:00:00.000000Z",
            "location": "Demo Convention Center",
            "address": "123 Demo Street",
            "city": "Demo City",
            "country": "Demo Country",
            "image": "images/demo-event.png",
            "is_active": true,
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z",
            "company": {
                "id": 1,
                "name": "Demo Company",
                "title_en": "Demo Company Inc.",
                "title_ar": "شركة تجريبية",
                "description_en": "This is a demo company for testing purposes.",
                "description_ar": "هذه شركة تجريبية لأغراض الاختبار.",
                "logo": "images/demo-logo.png",
                "profile_image": "images/demo-profile.png",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            },
            "ticket_types": [
                {
                    "id": 1,
                    "event_id": 1,
                    "name": "VIP",
                    "description": "VIP access to all areas and sessions.",
                    "price": 199.99,
                    "quantity": 50,
                    "background_image": "images/vip-ticket.png",
                    "qrcode_position": "center",
                    "created_at": "2023-11-01T00:00:00.000000Z",
                    "updated_at": "2023-11-01T00:00:00.000000Z"
                }
            ]
        }
    ]
}
```

#### Get Event Details
**Endpoint:** `GET /api/admin/events/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "event": {
        "id": 1,
        "company_id": 1,
        "name": "Demo Conference 2023",
        "description": "A demo conference for testing the QR code event management system.",
        "start_date": "2023-12-01T00:00:00.000000Z",
        "end_date": "2023-12-03T00:00:00.000000Z",
        "location": "Demo Convention Center",
        "address": "123 Demo Street",
        "city": "Demo City",
        "country": "Demo Country",
        "image": "images/demo-event.png",
        "is_active": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "company": {
            "id": 1,
            "name": "Demo Company",
            "title_en": "Demo Company Inc.",
            "title_ar": "شركة تجريبية",
            "description_en": "This is a demo company for testing purposes.",
            "description_ar": "هذه شركة تجريبية لأغراض الاختبار.",
            "logo": "images/demo-logo.png",
            "profile_image": "images/demo-profile.png",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z"
        },
        "ticket_types": [
            {
                "id": 1,
                "event_id": 1,
                "name": "VIP",
                "description": "VIP access to all areas and sessions.",
                "price": 199.99,
                "quantity": 50,
                "background_image": "images/vip-ticket.png",
                "qrcode_position": "center",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            }
        ]
    }
}
```

#### Assign Company to Event
**Endpoint:** `POST /api/admin/events/{id}/assign-company`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: application/json
```

**Request:**
```json
{
    "company_id": 2
}
```

**Response:**
```json
{
    "message": "Company assigned to event successfully",
    "event": {
        "id": 1,
        "company_id": 2,
        "name": "Demo Conference 2023",
        "description": "A demo conference for testing the QR code event management system.",
        "start_date": "2023-12-01T00:00:00.000000Z",
        "end_date": "2023-12-03T00:00:00.000000Z",
        "location": "Demo Convention Center",
        "address": "123 Demo Street",
        "city": "Demo City",
        "country": "Demo Country",
        "image": "images/demo-event.png",
        "is_active": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "company": {
            "id": 2,
            "name": "New Company",
            "title_en": "New Company Inc.",
            "title_ar": "شركة جديدة",
            "description_en": "This is a new company.",
            "description_ar": "هذه شركة جديدة.",
            "logo": "images/companies/some-logo.jpg",
            "profile_image": "images/companies/some-profile.jpg",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z"
        }
    }
}
```

## Scanner API Endpoints

These endpoints are only accessible to users with the scanner role.

### Get Events
**Endpoint:** `GET /api/scanner/events`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "events": [
        {
            "id": 1,
            "company_id": 1,
            "name": "Demo Conference 2023",
            "description": "A demo conference for testing the QR code event management system.",
            "start_date": "2023-12-01T00:00:00.000000Z",
            "end_date": "2023-12-03T00:00:00.000000Z",
            "location": "Demo Convention Center",
            "address": "123 Demo Street",
            "city": "Demo City",
            "country": "Demo Country",
            "image": "images/demo-event.png",
            "is_active": true,
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z",
            "ticket_types": [
                {
                    "id": 1,
                    "event_id": 1,
                    "name": "VIP",
                    "description": "VIP access to all areas and sessions.",
                    "price": 199.99,
                    "quantity": 50,
                    "background_image": "images/vip-ticket.png",
                    "qrcode_position": "center",
                    "created_at": "2023-11-01T00:00:00.000000Z",
                    "updated_at": "2023-11-01T00:00:00.000000Z"
                }
            ]
        }
    ]
}
```

### Get Event Details
**Endpoint:** `GET /api/scanner/events/{id}`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "event": {
        "id": 1,
        "company_id": 1,
        "name": "Demo Conference 2023",
        "description": "A demo conference for testing the QR code event management system.",
        "start_date": "2023-12-01T00:00:00.000000Z",
        "end_date": "2023-12-03T00:00:00.000000Z",
        "location": "Demo Convention Center",
        "address": "123 Demo Street",
        "city": "Demo City",
        "country": "Demo Country",
        "image": "images/demo-event.png",
        "is_active": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T00:00:00.000000Z",
        "ticket_types": [
            {
                "id": 1,
                "event_id": 1,
                "name": "VIP",
                "description": "VIP access to all areas and sessions.",
                "price": 199.99,
                "quantity": 50,
                "background_image": "images/vip-ticket.png",
                "qrcode_position": "center",
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T00:00:00.000000Z"
            }
        ]
    }
}
```

### Verify Attendee
**Endpoint:** `POST /api/scanner/verify`

**Headers:**
```
Authorization: Bearer your-api-token
Content-Type: application/json
```

**Request:**
```json
{
    "qrcode": "550e8400-e29b-41d4-a716-446655440000",
    "event_id": 1
}
```

**Response (Success):**
```json
{
    "verified": true,
    "message": "Attendee verified successfully",
    "attendee": {
        "id": 1,
        "event_id": 1,
        "ticket_type_id": 1,
        "name": "John Doe",
        "email": "john.doe@example.com",
        "phone": "1234567890",
        "qrcode": "550e8400-e29b-41d4-a716-446655440000",
        "is_attended": true,
        "attended_at": "2023-11-01T12:00:00.000000Z",
        "verified_by": 3,
        "email_sent": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T12:00:00.000000Z",
        "ticket_type": {
            "id": 1,
            "event_id": 1,
            "name": "VIP",
            "description": "VIP access to all areas and sessions.",
            "price": 199.99,
            "quantity": 50,
            "background_image": "images/vip-ticket.png",
            "qrcode_position": "center",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z"
        }
    }
}
```

**Response (Already Verified):**
```json
{
    "verified": false,
    "message": "Attendee already verified",
    "attendee": {
        "id": 1,
        "event_id": 1,
        "ticket_type_id": 1,
        "name": "John Doe",
        "email": "john.doe@example.com",
        "phone": "1234567890",
        "qrcode": "550e8400-e29b-41d4-a716-446655440000",
        "is_attended": true,
        "attended_at": "2023-11-01T12:00:00.000000Z",
        "verified_by": 3,
        "email_sent": true,
        "created_at": "2023-11-01T00:00:00.000000Z",
        "updated_at": "2023-11-01T12:00:00.000000Z",
        "ticket_type": {
            "id": 1,
            "event_id": 1,
            "name": "VIP",
            "description": "VIP access to all areas and sessions.",
            "price": 199.99,
            "quantity": 50,
            "background_image": "images/vip-ticket.png",
            "qrcode_position": "center",
            "created_at": "2023-11-01T00:00:00.000000Z",
            "updated_at": "2023-11-01T00:00:00.000000Z"
        }
    }
}
```

**Response (Invalid QR Code):**
```json
{
    "verified": false,
    "message": "Invalid QR code"
}
```

### Get Verification History
**Endpoint:** `GET /api/scanner/history`

**Headers:**
```
Authorization: Bearer your-api-token
```

**Response:**
```json
{
    "history": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "event_id": 1,
                "ticket_type_id": 1,
                "name": "John Doe",
                "email": "john.doe@example.com",
                "phone": "1234567890",
                "qrcode": "550e8400-e29b-41d4-a716-446655440000",
                "is_attended": true,
                "attended_at": "2023-11-01T12:00:00.000000Z",
                "verified_by": 3,
                "email_sent": true,
                "created_at": "2023-11-01T00:00:00.000000Z",
                "updated_at": "2023-11-01T12:00:00.000000Z",
                "event": {
                    "id": 1,
                    "company_id": 1,
                    "name": "Demo Conference 2023",
                    "description": "A demo conference for testing the QR code event management system.",
                    "start_date": "2023-12-01T00:00:00.000000Z",
                    "end_date": "2023-12-03T00:00:00.000000Z",
                    "location": "Demo Convention Center",
                    "address": "123 Demo Street",
                    "city": "Demo City",
                    "country": "Demo Country",
                    "image": "images/demo-event.png",
                    "is_active": true,
                    "created_at": "2023-11-01T00:00:00.000000Z",
                    "updated_at": "2023-11-01T00:00:00.000000Z"
                },
                "ticket_type": {
                    "id": 1,
                    "event_id": 1,
                    "name": "VIP",
                    "description": "VIP access to all areas and sessions.",
                    "price": 199.99,
                    "quantity": 50,
                    "background_image": "images/vip-ticket.png",
                    "qrcode_position": "center",
                    "created_at": "2023-11-01T00:00:00.000000Z",
                    "updated_at": "2023-11-01T00:00:00.000000Z"
                }
            }
        ],
        "first_page_url": "http://qrcode.event/api/scanner/history?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "http://qrcode.event/api/scanner/history?page=1",
        "links": [
            {
                "url": null,
                "label": "&laquo; Previous",
                "active": false
            },
            {
                "url": "http://qrcode.event/api/scanner/history?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next &raquo;",
                "active": false
            }
        ],
        "next_page_url": null,
        "path": "http://qrcode.event/api/scanner/history",
        "per_page": 20,
        "prev_page_url": null,
        "to": 1,
        "total": 1
    }
}
```

## Running the Dummy Data Seeder

To populate the database with dummy data for testing, run the following command:

```bash
php artisan seed:dummy-data
```

This will seed the database with:
1. Roles and permissions
2. Admin user
3. Demo company with company and scanner users
4. Demo event with ticket types and attendees
