# Type Inventory & Classification

This document catalogs all types from the monolithic `apps/website/lib/apiClient.ts` file (lines 13-634) and inline DTOs from `apps/website/app/races/[id]/results/page.tsx` (lines 17-56). Types are organized by domain and classified according to Clean Architecture principles.

## Summary
- **Total Types**: 89 types in apiClient.ts + 5 inline DTOs = 94 types
- **Domains**: Common/Shared, League, Driver, Team, Race, Sponsor, Media, Analytics, Auth, Payments
- **Classification Breakdown**:
  - DTO: 45 (pure transport objects, no business logic)
  - ViewModel: 44 (UI-ready with potential computed properties)
  - Input: 3 (request parameters)
  - Output: 2 (response wrappers)

## Extraction Strategy Overview
- **DTOs**: Move to `apps/website/lib/dtos/{domain}/` with filename `{TypeName}.ts`
- **ViewModels**: Move to `apps/website/lib/view-models/{domain}/` with filename `{TypeName}.ts`
- **Inputs/Outputs**: Treat as DTOs in appropriate domain
- **Dependencies**: Update imports after extraction
- **No Empty Files**: Ensure each extracted file has content
- **Clean Architecture**: Maintain separation between transport (DTO) and presentation (ViewModel) layers

---

## Common/Shared Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| DriverDTO | 13-19 | DTO | `apps/website/lib/dtos/common/DriverDto.ts` | None | LeagueAdminPresenter.ts, TeamAdminPresenter.ts, presenters (multiple) |
| ProtestViewModel | 21-29 | ViewModel | `apps/website/lib/view-models/common/ProtestViewModel.ts` | None | LeagueAdminProtestsDto.ts |
| LeagueMemberViewModel | 31-36 | ViewModel | `apps/website/lib/view-models/league/LeagueMemberViewModel.ts` | DriverDTO | LeagueMembershipsDto.ts, LeagueAdminDto.ts, leagueMembership.ts |
| StandingEntryViewModel | 38-46 | ViewModel | `apps/website/lib/view-models/league/StandingEntryViewModel.ts` | DriverDTO | LeagueStandingsDto.ts, LeagueStandingsPresenter.ts |
| ScheduledRaceViewModel | 48-54 | ViewModel | `apps/website/lib/view-models/race/ScheduledRaceViewModel.ts` | None | LeagueScheduleDto.ts |

---

## League Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| LeagueSummaryViewModel | 57-70 | ViewModel | `apps/website/lib/view-models/league/LeagueSummaryViewModel.ts` | None | AllLeaguesWithCapacityAndScoringPresenter.ts |
| AllLeaguesWithCapacityViewModel | 72-74 | ViewModel | `apps/website/lib/view-models/league/AllLeaguesWithCapacityViewModel.ts` | LeagueSummaryViewModel | ScheduleRaceFormPresenter.ts, AllLeaguesWithCapacityAndScoringPresenter.ts |
| LeagueStatsDto | 76-79 | DTO | `apps/website/lib/dtos/league/LeagueStatsDto.ts` | None | None found |
| LeagueJoinRequestViewModel | 80-86 | ViewModel | `apps/website/lib/view-models/league/LeagueJoinRequestViewModel.ts` | None | LeagueAdminDto.ts, LeagueAdminPresenter.ts |
| LeagueAdminPermissionsViewModel | 88-95 | ViewModel | `apps/website/lib/view-models/league/LeagueAdminPermissionsViewModel.ts` | None | LeagueAdminPermissionsDto.ts (existing), LeagueAdminPresenter.ts |
| LeagueOwnerSummaryViewModel | 97-102 | ViewModel | `apps/website/lib/view-models/league/LeagueOwnerSummaryViewModel.ts` | None | LeagueAdminPresenter.ts |
| LeagueConfigFormModelDto | 104-111 | DTO | `apps/website/lib/dtos/league/LeagueConfigFormModelDto.ts` | None | LeagueAdminDto.ts |
| LeagueAdminProtestsViewModel | 113-115 | ViewModel | `apps/website/lib/view-models/league/LeagueAdminProtestsViewModel.ts` | ProtestViewModel | LeagueAdminProtestsDto.ts, LeagueAdminPresenter.ts |
| LeagueSeasonSummaryViewModel | 117-123 | ViewModel | `apps/website/lib/view-models/league/LeagueSeasonSummaryViewModel.ts` | None | LeagueAdminPresenter.ts |
| LeagueMembershipsViewModel | 125-127 | ViewModel | `apps/website/lib/view-models/league/LeagueMembershipsViewModel.ts` | LeagueMemberViewModel | LeagueMembershipsDto.ts, leagueMembership.ts |
| LeagueStandingsViewModel | 129-131 | ViewModel | `apps/website/lib/view-models/league/LeagueStandingsViewModel.ts` | StandingEntryViewModel | LeagueStandingsPresenter.ts, TeamStandingsPresenter.ts |
| LeagueScheduleViewModel | 133-135 | ViewModel | `apps/website/lib/view-models/league/LeagueScheduleViewModel.ts` | ScheduledRaceViewModel | LeagueScheduleDto.ts |
| LeagueStatsViewModel | 137-145 | ViewModel | `apps/website/lib/view-models/league/LeagueStatsViewModel.ts` | None | None found |
| LeagueAdminViewModel | 147-151 | ViewModel | `apps/website/lib/view-models/league/LeagueAdminViewModel.ts` | LeagueConfigFormModelDto, LeagueMemberViewModel, LeagueJoinRequestViewModel | None found |
| CreateLeagueInput | 153-159 | Input | `apps/website/lib/dtos/league/CreateLeagueInput.ts` | None | leagueWizardService.ts |
| CreateLeagueOutput | 161-164 | Output | `apps/website/lib/dtos/league/CreateLeagueOutput.ts` | None | None found |

---

## Driver Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| DriverLeaderboardItemViewModel | 167-175 | ViewModel | `apps/website/lib/view-models/driver/DriverLeaderboardItemViewModel.ts` | None | DriversLeaderboardPresenter.ts |
| DriversLeaderboardViewModel | 177-179 | ViewModel | `apps/website/lib/view-models/driver/DriversLeaderboardViewModel.ts` | DriverLeaderboardItemViewModel | DriversLeaderboardPresenter.ts |
| DriverStatsDto | 181-183 | DTO | `apps/website/lib/dtos/driver/DriverStatsDto.ts` | None | None found |
| CompleteOnboardingInput | 185-188 | Input | `apps/website/lib/dtos/driver/CompleteOnboardingInput.ts` | None | None found |
| CompleteOnboardingOutput | 190-193 | Output | `apps/website/lib/dtos/driver/CompleteOnboardingOutput.ts` | None | None found |
| DriverRegistrationStatusViewModel | 195-199 | ViewModel | `apps/website/lib/view-models/driver/DriverRegistrationStatusViewModel.ts` | None | None found |

---

## Team Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| TeamSummaryViewModel | 202-208 | ViewModel | `apps/website/lib/view-models/team/TeamSummaryViewModel.ts` | None | AllTeamsPresenter.ts |
| AllTeamsViewModel | 210-212 | ViewModel | `apps/website/lib/view-models/team/AllTeamsViewModel.ts` | TeamSummaryViewModel | AllTeamsPresenter.ts |
| TeamMemberViewModel | 214-219 | ViewModel | `apps/website/lib/view-models/team/TeamMemberViewModel.ts` | DriverDTO | TeamDetailsPresenter.ts, TeamRosterPresenter.ts |
| TeamJoinRequestItemViewModel | 221-227 | ViewModel | `apps/website/lib/view-models/team/TeamJoinRequestItemViewModel.ts` | None | TeamAdminPresenter.ts |
| TeamDetailsViewModel | 229-237 | ViewModel | `apps/website/lib/view-models/team/TeamDetailsViewModel.ts` | TeamMemberViewModel | TeamDetailsPresenter.ts |
| TeamMembersViewModel | 239-241 | ViewModel | `apps/website/lib/view-models/team/TeamMembersViewModel.ts` | TeamMemberViewModel | TeamRosterPresenter.ts |
| TeamJoinRequestsViewModel | 243-245 | ViewModel | `apps/website/lib/view-models/team/TeamJoinRequestsViewModel.ts` | TeamJoinRequestItemViewModel | None found |
| DriverTeamViewModel | 247-252 | ViewModel | `apps/website/lib/view-models/team/DriverTeamViewModel.ts` | None | DriverTeamPresenter.ts |
| CreateTeamInput | 254-258 | Input | `apps/website/lib/dtos/team/CreateTeamInput.ts` | None | None found |
| CreateTeamOutput | 260-263 | Output | `apps/website/lib/dtos/team/CreateTeamOutput.ts` | None | None found |
| UpdateTeamInput | 265-269 | Input | `apps/website/lib/dtos/team/UpdateTeamInput.ts` | None | TeamAdminPresenter.ts |
| UpdateTeamOutput | 271-273 | Output | `apps/website/lib/dtos/team/UpdateTeamOutput.ts` | None | None found |

---

## Race Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| RaceListItemViewModel | 276-284 | ViewModel | `apps/website/lib/view-models/race/RaceListItemViewModel.ts` | None | None found |
| AllRacesPageViewModel | 286-288 | ViewModel | `apps/website/lib/view-models/race/AllRacesPageViewModel.ts` | RaceListItemViewModel | None found |
| RaceStatsDto | 290-292 | DTO | `apps/website/lib/dtos/race/RaceStatsDto.ts` | None | None found |
| RaceDetailEntryViewModel | 295-302 | ViewModel | `apps/website/lib/view-models/race/RaceDetailEntryViewModel.ts` | None | None found |
| RaceDetailUserResultViewModel | 304-313 | ViewModel | `apps/website/lib/view-models/race/RaceDetailUserResultViewModel.ts` | None | None found |
| RaceDetailRaceViewModel | 315-326 | ViewModel | `apps/website/lib/view-models/race/RaceDetailRaceViewModel.ts` | None | None found |
| RaceDetailLeagueViewModel | 328-336 | ViewModel | `apps/website/lib/view-models/race/RaceDetailLeagueViewModel.ts` | None | None found |
| RaceDetailRegistrationViewModel | 338-341 | ViewModel | `apps/website/lib/view-models/race/RaceDetailRegistrationViewModel.ts` | None | None found |
| RaceDetailViewModel | 343-350 | ViewModel | `apps/website/lib/view-models/race/RaceDetailViewModel.ts` | RaceDetailRaceViewModel, RaceDetailLeagueViewModel, RaceDetailEntryViewModel, RaceDetailRegistrationViewModel, RaceDetailUserResultViewModel | None found |
| RacesPageDataRaceViewModel | 352-364 | ViewModel | `apps/website/lib/view-models/race/RacesPageDataRaceViewModel.ts` | None | races/page.tsx, races/all/page.tsx |
| RacesPageDataViewModel | 366-368 | ViewModel | `apps/website/lib/view-models/race/RacesPageDataViewModel.ts` | RacesPageDataRaceViewModel | races/page.tsx, races/all/page.tsx |
| RaceResultViewModel | 370-381 | ViewModel | `apps/website/lib/view-models/race/RaceResultViewModel.ts` | None | None found |
| RaceResultsDetailViewModel | 383-387 | ViewModel | `apps/website/lib/view-models/race/RaceResultsDetailViewModel.ts` | RaceResultViewModel | races/[id]/results/page.tsx |
| RaceWithSOFViewModel | 389-393 | ViewModel | `apps/website/lib/view-models/race/RaceWithSOFViewModel.ts` | None | races/[id]/results/page.tsx |
| RaceProtestViewModel | 395-405 | ViewModel | `apps/website/lib/view-models/race/RaceProtestViewModel.ts` | None | None found |
| RaceProtestsViewModel | 407-410 | ViewModel | `apps/website/lib/view-models/race/RaceProtestsViewModel.ts` | RaceProtestViewModel | races/[id]/stewarding/page.tsx |
| RacePenaltyViewModel | 412-421 | ViewModel | `apps/website/lib/view-models/race/RacePenaltyViewModel.ts` | None | None found |
| RacePenaltiesViewModel | 423-426 | ViewModel | `apps/website/lib/view-models/race/RacePenaltiesViewModel.ts` | RacePenaltyViewModel | races/[id]/stewarding/page.tsx |
| RegisterForRaceParams | 428-431 | Input | `apps/website/lib/dtos/race/RegisterForRaceParams.ts` | None | None found |
| WithdrawFromRaceParams | 433-435 | Input | `apps/website/lib/dtos/race/WithdrawFromRaceParams.ts` | None | None found |
| ImportRaceResultsInput | 437-439 | Input | `apps/website/lib/dtos/race/ImportRaceResultsInput.ts` | None | None found |
| ImportRaceResultsSummaryViewModel | 441-447 | ViewModel | `apps/website/lib/view-models/race/ImportRaceResultsSummaryViewModel.ts` | None | None found |

---

## Sponsor Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| GetEntitySponsorshipPricingResultDto | 450-454 | DTO | `apps/website/lib/dtos/sponsor/GetEntitySponsorshipPricingResultDto.ts` | None | None found |
| SponsorViewModel | 456-462 | ViewModel | `apps/website/lib/view-models/sponsor/SponsorViewModel.ts` | None | None found |
| GetSponsorsOutput | 463-465 | Output | `apps/website/lib/dtos/sponsor/GetSponsorsOutput.ts` | SponsorViewModel | None found |
| CreateSponsorInput | 467-472 | Input | `apps/website/lib/dtos/sponsor/CreateSponsorInput.ts` | None | None found |
| CreateSponsorOutput | 474-477 | Output | `apps/website/lib/dtos/sponsor/CreateSponsorOutput.ts` | None | None found |
| SponsorDashboardDTO | 479-485 | DTO | `apps/website/lib/dtos/sponsor/SponsorDashboardDto.ts` | None | None found |
| SponsorshipDetailViewModel | 487-497 | ViewModel | `apps/website/lib/view-models/sponsor/SponsorshipDetailViewModel.ts` | None | None found |
| SponsorSponsorshipsDTO | 499-502 | DTO | `apps/website/lib/dtos/sponsor/SponsorSponsorshipsDto.ts` | SponsorshipDetailViewModel | None found |

---

## Media Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| RequestAvatarGenerationInput | 505-508 | Input | `apps/website/lib/dtos/media/RequestAvatarGenerationInput.ts` | None | None found |
| RequestAvatarGenerationOutput | 510-514 | Output | `apps/website/lib/dtos/media/RequestAvatarGenerationOutput.ts` | None | None found |

---

## Analytics Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| RecordPageViewInput | 517-521 | Input | `apps/website/lib/dtos/analytics/RecordPageViewInput.ts` | None | None found |
| RecordPageViewOutput | 523-525 | Output | `apps/website/lib/dtos/analytics/RecordPageViewOutput.ts` | None | None found |
| RecordEngagementInput | 527-532 | Input | `apps/website/lib/dtos/analytics/RecordEngagementInput.ts` | None | None found |
| RecordEngagementOutput | 534-536 | Output | `apps/website/lib/dtos/analytics/RecordEngagementOutput.ts` | None | None found |

---

## Auth Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| LoginParams | 539-542 | Input | `apps/website/lib/dtos/auth/LoginParams.ts` | None | None found |
| SignupParams | 544-548 | Input | `apps/website/lib/dtos/auth/SignupParams.ts` | None | None found |
| SessionData | 550-556 | DTO | `apps/website/lib/dtos/auth/SessionData.ts` | None | None found |

---

## Payments Domain Types

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| PaymentViewModel | 559-565 | ViewModel | `apps/website/lib/view-models/payments/PaymentViewModel.ts` | None | None found |
| GetPaymentsOutput | 567-569 | Output | `apps/website/lib/dtos/payments/GetPaymentsOutput.ts` | PaymentViewModel | None found |
| CreatePaymentInput | 571-577 | Input | `apps/website/lib/dtos/payments/CreatePaymentInput.ts` | None | None found |
| CreatePaymentOutput | 579-582 | Output | `apps/website/lib/dtos/payments/CreatePaymentOutput.ts` | None | None found |
| MembershipFeeViewModel | 584-589 | ViewModel | `apps/website/lib/view-models/payments/MembershipFeeViewModel.ts` | None | None found |
| MemberPaymentViewModel | 591-596 | ViewModel | `apps/website/lib/view-models/payments/MemberPaymentViewModel.ts` | None | None found |
| GetMembershipFeesOutput | 598-601 | Output | `apps/website/lib/dtos/payments/GetMembershipFeesOutput.ts` | MembershipFeeViewModel, MemberPaymentViewModel | None found |
| PrizeViewModel | 603-609 | ViewModel | `apps/website/lib/view-models/payments/PrizeViewModel.ts` | None | None found |
| GetPrizesOutput | 611-613 | Output | `apps/website/lib/dtos/payments/GetPrizesOutput.ts` | PrizeViewModel | None found |
| WalletTransactionViewModel | 615-621 | ViewModel | `apps/website/lib/view-models/payments/WalletTransactionViewModel.ts` | None | None found |
| WalletViewModel | 623-628 | ViewModel | `apps/website/lib/view-models/payments/WalletViewModel.ts` | WalletTransactionViewModel | None found |
| GetWalletOutput | 630-632 | Output | `apps/website/lib/dtos/payments/GetWalletOutput.ts` | WalletViewModel | None found |

---

## Inline DTOs from Results Page

| Type Name | Line Range | Classification | Target Location | Dependencies | Used By |
|-----------|------------|----------------|-----------------|--------------|---------|
| PenaltyTypeDTO | 17-24 | DTO | `apps/website/lib/dtos/race/PenaltyTypeDto.ts` | None | PenaltyTypeDto.ts (existing file) |
| PenaltyData | 26-30 | DTO | `apps/website/lib/dtos/race/PenaltyData.ts` | PenaltyTypeDTO | None found |
| RaceResultRowDTO | 32-41 | DTO | `apps/website/lib/dtos/race/RaceResultRowDto.ts` | None | None found |
| DriverRowDTO | 43-46 | DTO | `apps/website/lib/dtos/race/DriverRowDto.ts` | None | None found |
| ImportResultRowDTO | 48-56 | DTO | `apps/website/lib/dtos/race/ImportResultRowDto.ts` | None | None found |

---

## Extraction Recommendations

1. **Create Directory Structure**:
   - `apps/website/lib/dtos/common/`
   - `apps/website/lib/dtos/league/`
   - `apps/website/lib/dtos/driver/`
   - `apps/website/lib/dtos/team/`
   - `apps/website/lib/dtos/race/`
   - `apps/website/lib/dtos/sponsor/`
   - `apps/website/lib/dtos/media/`
   - `apps/website/lib/dtos/analytics/`
   - `apps/website/lib/dtos/auth/`
   - `apps/website/lib/dtos/payments/`
   - `apps/website/lib/view-models/common/`
   - `apps/website/lib/view-models/league/`
   - `apps/website/lib/view-models/driver/`
   - `apps/website/lib/view-models/team/`
   - `apps/website/lib/view-models/race/`
   - `apps/website/lib/view-models/sponsor/`
   - `apps/website/lib/view-models/payments/`

2. **Move Types Sequentially**:
   - Start with types that have no dependencies
   - Update imports in apiClient.ts and dependent files
   - Test after each major domain extraction

3. **Update Existing DTOs**:
   - Some DTOs already exist (e.g., LeagueAdminPermissionsDto.ts)
   - Ensure consistency in naming and structure

4. **Clean Architecture Compliance**:
   - DTOs: Pure data transfer, no methods
   - ViewModels: May include computed properties for UI
   - Clear separation maintained

5. **Post-Extraction**:
   - Remove types from apiClient.ts
   - Update all import statements
   - Run tests to ensure no breaking changes