You are tasked with building a full-stack web application named 'My Insurance Rights' (Hasar Asistanı) using Next.js 14 with the App Router, Drizzle ORM for database interactions, and Tailwind CSS for styling. The application aims to help individuals manage their post-car accident insurance claims, track injuries, treatments, documents, and communications, and provide guidance to ensure fair compensation.
Your goal is to create a fully functional MVP with complete CRUD operations for all core entities, user authentication, and a multi-page structure. Do not create a single-page application (SPA) or just a landing page.
**Core Requirements:**
1. **Project Setup:**
* Initialize a Next.js 14 project using the App Router (`npx create-next-app@latest`).
* Configure TypeScript.
* Integrate Tailwind CSS for styling.
* Set up Drizzle ORM with a PostgreSQL database. Provide `drizzle.config.ts` and schema files. Include a Docker Compose setup for a local PostgreSQL instance.
2. **User Authentication:**
* Implement a simple email/password authentication system. This should include user registration, login, and logout functionalities.
* Use JWT for session management.
* Store `passwordHash` in the database.
3. **Database Schema (Drizzle ORM):**
* `users` table:
* `id`: `serial('id').primaryKey()`
* `email`: `varchar('email', { length: 255 }).notNull().unique()`
* `passwordHash`: `varchar('password_hash', { length: 255 }).notNull()`
* `createdAt`: `timestamp('created_at').defaultNow()`
* `updatedAt`: `timestamp('updated_at').defaultNow()`
* `claims` table:
* `id`: `serial('id').primaryKey()`
* `userId`: `integer('user_id').references(() => users.id).notNull()`
* `title`: `varchar('title', { length: 255 }).notNull()` (e.g., "Car Accident July 2023")
* `description`: `text('description')`
* `accidentDate`: `timestamp('accident_date').notNull()`
* `status`: `varchar('status', { enum: ['Draft', 'Pending Review', 'Negotiating', 'Settled', 'Closed'] }).default('Draft').notNull()`
* `createdAt`: `timestamp('created_at').defaultNow()`
* `updatedAt`: `timestamp('updated_at').defaultNow()`
* `injuries` table:
* `id`: `serial('id').primaryKey()`
* `claimId`: `integer('claim_id').references(() => claims.id).notNull()`
* `name`: `varchar('name', { length: 255 }).notNull()` (e.g., "Herniated Disc")
* `description`: `text('description')`
* `severity`: `varchar('severity', { enum: ['Mild', 'Moderate', 'Severe'] }).notNull()`
* `diagnosedDate`: `timestamp('diagnosed_date')`
* `status`: `varchar('status', { enum: ['Active', 'Recovering', 'Resolved'] }).default('Active').notNull()`
* `createdAt`: `timestamp('created_at').defaultNow()`
* `updatedAt`: `timestamp('updated_at').defaultNow()`
* `treatments` table:
* `id`: `serial('id').primaryKey()`
* `injuryId`: `integer('injury_id').references(() => injuries.id).notNull()`
* `name`: `varchar('name', { length: 255 }).notNull()` (e.g., "Physical Therapy")
* `type`: `varchar('type', { length: 255 })`
* `provider`: `varchar('provider', { length: 255 })` (e.g., "Dr. Smith")
* `startDate`: `timestamp('start_date')`
* `endDate`: `timestamp('end_date')`
* `cost`: `decimal('cost', { precision: 10, scale: 2 })`
* `notes`: `text('notes')`
* `createdAt`: `timestamp('created_at').defaultNow()`
* `updatedAt`: `timestamp('updated_at').defaultNow()`
* `documents` table:
* `id`: `serial('id').primaryKey()`
* `claimId`: `integer('claim_id').references(() => claims.id).notNull()`
* `type`: `varchar('type', { enum: ['Police Report', 'Medical Bill', 'Insurance Letter', 'Photo', 'Other'] }).notNull()`
* `fileName`: `varchar('file_name', { length: 255 }).notNull()`
* `fileUrl`: `varchar('file_url', { length: 2048 }).notNull()` (for file storage like S3 or local uploads)
* `uploadedAt`: `timestamp('uploaded_at').defaultNow()`
* `createdAt`: `timestamp('created_at').defaultNow()`
* `updatedAt`: `timestamp('updated_at').defaultNow()`
* `communications` table:
* `id`: `serial('id').primaryKey()`
* `claimId`: `integer('claim_id').references(() => claims.id).notNull()`
* `type`: `varchar('type', { enum: ['Email', 'Phone Call', 'Letter', 'Meeting'] }).notNull()`
* `participant`: `varchar('participant', { length: 255 })` (e.g., "Adjuster John Doe, GEICO")
* `date`: `timestamp('date').notNull()`
* `summary`: `text('summary').notNull()`
* `sentiment`: `varchar('sentiment', { enum: ['Positive', 'Neutral', 'Negative'] })`
* `createdAt`: `timestamp('created_at').defaultNow()`
* `updatedAt`: `timestamp('updated_at').defaultNow()`
4. **Pages (Next.js App Router - `app/` directory):**
* `app/page.tsx`: Public landing page showcasing the app's benefits.
* `app/(auth)/login/page.tsx`: Login form.
* `app/(auth)/register/page.tsx`: Registration form.
* `app/(app)/dashboard/page.tsx`: Authenticated user's dashboard, displaying a summary of their active claims.
* `app/(app)/claims/page.tsx`: List all claims for the authenticated user.
* `app/(app)/claims/new/page.tsx`: Form to create a new claim.
* `app/(app)/claims/[claimId]/page.tsx`: Detailed view of a single claim, with tabs or sections for Injuries, Treatments, Documents, and Communications. This page should also allow editing of the main claim details.
* `app/(app)/claims/[claimId]/injuries/new/page.tsx`: Form to add a new injury for a specific claim.
* `app/(app)/claims/[claimId]/injuries/[injuryId]/edit/page.tsx`: Form to edit a