# Rentec LIVE adapter — apply

    cp -R rentec-live/app/*       ./app/
    cp -R rentec-live/database/*  ./database/
    cp -R rentec-live/tests/*     ./tests/

## 1. Register the live adapter (replaces the mock) in AdapterManager:
    'rentec' => \App\Integrations\Adapters\Rentec\RentecAdapter::class,

## 2. SyncManager idField — the live API uses the composite "id" string:
    'rentec' => \App\Integrations\Adapters\Rentec\RentecAdapter::idField($resource),
(or simply 'id' — the live adapter's idField() returns 'id' for every resource)

## 3. Wire the 'portfolio' aggregation — see docs/portfolio-aggregation.md (one method).

## 4. Mark rentec as no longer mocked + seed the live metrics:
    php artisan tinker --execute="App\Integrations\Models\Integration::where('key','rentec')->update(['is_mocked'=>false,'auth_type'=>'api_key']);"
    php artisan db:seed --class=Database\\Seeders\\RentecLiveMetricSeeder --force

## 5. Store the API key + sync
Put the Rentec key in Integration Settings (add a 'rentec' group), or for a first run:

    php artisan tinker --execute="
    \$org = App\Organizations\Models\Organization::first();
    app(App\Platform\Tenancy\CurrentOrganization::class)->set(\$org);
    \$i = App\Integrations\Models\Integration::where('key','rentec')->first();
    \$a = App\Integrations\Models\IntegrationAccount::firstOrCreate(
      ['organization_id'=>\$org->id,'integration_id'=>\$i->id],
      ['display_name'=>'Rentec Live','status'=>'healthy','sync_frequency'=>'daily',
       'selected_entities'=>['properties','tenants','leases']]);
    app(App\Integrations\CredentialVault::class)->store(\$a, new App\Integrations\Support\Credential(accessToken:'YOUR_RENTEC_KEY'));
    app(App\Sync\Services\SyncManager::class)->sync(\$a);
    echo 'rows: '.App\Ingestion\Models\RawPayload::where('organization_id',\$org->id)->count();
    "

## 6. Test
    php artisan test --filter=RentecLive

## What this gives you
Live Rentec data powering: total units, occupied/vacant, occupancy %, move-ins/outs,
net movement, leases expiring ≤90d, retention rows (tenure, days left, balance), and
scheduled rent by location — the numbers behind Austin's Report Overview, Tenants,
Vacancies, Retention and Income.

## Known gaps (need more Rentec data)
- UNIT / SUITE NUMBER: not present on leases. Check tenants[].properties[] — if it
  carries a unit label, we add it to retention/vacancy rows.
- ACTUAL INCOME (received, date-ranged): needs a charges/payments/ledger endpoint;
  recurring_rent gives SCHEDULED rent only.
