> ## Documentation Index
> Fetch the complete documentation index at: https://memberpulseptyltd.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# UJ-M-019: Download or Access Resource

> Member downloads or views a resource from the library

## Journey Overview

| Attribute      | Value                                     |
| -------------- | ----------------------------------------- |
| **Journey ID** | UJ-M-019                                  |
| **Actor**      | Member                                    |
| **Goal**       | Access and download a resource            |
| **Trigger**    | Member clicks on a resource they want     |
| **Outcome**    | Member has access to the resource content |

## Preconditions

* Resource exists and is published
* Member meets access requirements

## Journey Flow

```mermaid theme={null}
flowchart TD
    A[Click on resource] --> B[View resource details]
    B --> C{Access level check}
    C -->|Free| D[Download/View available]
    C -->|Member required| E{Is member?}
    C -->|Premium required| F{Has premium?}
    C -->|Paid resource| G{Already purchased?}
    E -->|Yes| D
    E -->|No| H[Prompt to login/register]
    F -->|Yes| D
    F -->|No| I[Prompt to upgrade]
    G -->|Yes| D
    G -->|No| J[Purchase flow]
    D --> K[Access resource]
    J --> L{Payment success?}
    L -->|Yes| K
    L -->|No| M[Payment retry]
```

## Detailed Steps

<Steps>
  <Step title="View Resource Details">
    Resource detail page shows:

    ```
    ┌─────────────────────────────────────────────────────────────┐
    │ [Preview Image/Thumbnail]                                   │
    ├─────────────────────────────────────────────────────────────┤
    │                                                             │
    │ 2025 Industry Trends Report                                 │
    │ ═══════════════════════════                                 │
    │                                                             │
    │ 📄 PDF • 45 pages • 2.3 MB                                  │
    │ 📅 Published: March 1, 2025                                 │
    │ 👤 Author: Research Team                                    │
    │ ⬇️ 1,234 downloads                                          │
    │                                                             │
    │ [Download PDF]  [Preview]  [Share]  [Save]                  │
    │                                                             │
    │ Description                                                 │
    │ ───────────                                                 │
    │ Comprehensive analysis of industry trends for 2025...       │
    │                                                             │
    │ Topics Covered                                              │
    │ • Market Analysis                                           │
    │ • Technology Trends                                         │
    │ • Regulatory Updates                                        │
    │                                                             │
    │ Related Resources                                           │
    │ [Resource cards...]                                         │
    │                                                             │
    └─────────────────────────────────────────────────────────────┘
    ```
  </Step>

  <Step title="Check Access Level">
    System determines access:

    | Resource Level | Member Status  | Result          |
    | -------------- | -------------- | --------------- |
    | Free           | Any            | Full access     |
    | Member         | Not logged in  | Login prompt    |
    | Member         | Logged in      | Full access     |
    | Premium        | Basic member   | Upgrade prompt  |
    | Premium        | Premium member | Full access     |
    | Paid           | Not purchased  | Purchase prompt |
    | Paid           | Purchased      | Full access     |
  </Step>

  <Step title="Access Resource (If Allowed)">
    For accessible resources:

    **Download:**

    * Click "Download" button
    * File downloads to device
    * Download count incremented
    * Activity logged

    **View Online:**

    * Click "View" or "Preview"
    * Opens in-browser viewer
    * PDF viewer for documents
    * Video player for videos
  </Step>

  <Step title="Purchase Resource (If Paid)">
    For paid resources not yet purchased:

    ```
    ┌─────────────────────────────────────────────────────────────┐
    │ Purchase Resource                                           │
    ├─────────────────────────────────────────────────────────────┤
    │                                                             │
    │ 2025 Industry Trends Report                                 │
    │                                                             │
    │ Price: $29.00                                               │
    │ Member Discount: -$5.00                                     │
    │ ─────────────────────                                       │
    │ Total: $24.00                                               │
    │                                                             │
    │ ✓ Lifetime access to this resource                          │
    │ ✓ Future updates included                                   │
    │ ✓ Download in multiple formats                              │
    │                                                             │
    │ [Purchase Now]                                              │
    │                                                             │
    └─────────────────────────────────────────────────────────────┘
    ```

    → Standard payment flow via Stripe
  </Step>

  <Step title="Gated Resource (Registration Required)">
    Some resources require registration/form completion:

    ```
    ┌─────────────────────────────────────────────────────────────┐
    │ Download Resource                                           │
    ├─────────────────────────────────────────────────────────────┤
    │                                                             │
    │ Complete the form below to access this resource:            │
    │                                                             │
    │ Name: [________________]                                    │
    │ Email: [________________]                                   │
    │ Company: [________________]                                 │
    │ Role: [________________]                                    │
    │                                                             │
    │ ☐ I agree to receive related communications                 │
    │                                                             │
    │ [Download]                                                  │
    │                                                             │
    └─────────────────────────────────────────────────────────────┘
    ```
  </Step>
</Steps>

## Resource Viewing Options

### Documents (PDF)

| Option   | Description           |
| -------- | --------------------- |
| Download | Save to device        |
| Preview  | In-browser PDF viewer |
| Print    | Direct print option   |

### Videos

| Option   | Description                   |
| -------- | ----------------------------- |
| Stream   | Watch in browser              |
| Download | Save for offline (if allowed) |
| Captions | Closed captions toggle        |

### Templates

| Option            | Description       |
| ----------------- | ----------------- |
| Download Original | Excel, Word, etc. |
| Download PDF      | View-only version |
| Open in App       | Direct app launch |

## Access Prompts

### Login Required

```
┌─────────────────────────────────────┐
│ Member Access Required              │
├─────────────────────────────────────┤
│ This resource is available to       │
│ members only.                       │
│                                     │
│ [Login]  [Register]                 │
└─────────────────────────────────────┘
```

### Premium Required

```
┌─────────────────────────────────────┐
│ Premium Resource                    │
├─────────────────────────────────────┤
│ This resource is included with      │
│ Premium membership.                 │
│                                     │
│ [Upgrade to Premium]                │
│ [View Membership Options]           │
└─────────────────────────────────────┘
```

## Download Tracking

System tracks:

* Who downloaded
* When downloaded
* Download count
* Access method (download vs view)

## Related Entities

* [`Resource`](/entities/core/resource)
* [`Payment Transaction`](/entities/integration/payment-transaction)

## Related Journeys

* [UJ-M-018](/member/journeys/browse-resources)
* [UJ-M-003](/member/journeys/choose-membership-plan)

## Acceptance Criteria

### Frontend

* [ ] Resource detail page with preview
* [ ] Download button (file types)
* [ ] In-browser viewer (PDFs, videos)
* [ ] Access control prompts
* [ ] Purchase flow integration
* [ ] Gated content forms
* [ ] Loading states during download
* [ ] Mobile-friendly access

### Backend

* [ ] `GET /api/resources/{id}` - Resource details
* [ ] `GET /api/resources/{id}/download` - Download file
* [ ] `POST /api/resources/{id}/access` - Log access
* [ ] `POST /api/resources/{id}/purchase` - Purchase flow
* [ ] Access control validation

### Permissions

* [ ] Access levels enforced per resource
* [ ] Purchases verified before download

### Business Rules

* [ ] Download count tracked
* [ ] Member discounts applied
* [ ] Purchased resources always accessible
* [ ] Gated resource data captured

### Error Handling

* [ ] File not found handling
* [ ] Download failure retry
* [ ] Payment failure handling
