# Projects API

Project management endpoints.

## Authentication

All endpoints require authentication (session cookie).

---

## GET /projects

**Description:** List all projects for the current user.

### Response

#### Success (200 OK)

```json
[
  {
    "id": "uuid",
    "name": "My Project",
    "description": "Project description",
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
]
```

---

## POST /projects

**Description:** Create a new project.

### Request

#### Request Body

```json
{
  "name": "My Project",
  "description": "Optional description"
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | `string` | Yes | Project name (max 255 chars) |
| `description` | `string` | No | Project description |

### Response

#### Success (201 Created)

```json
{
  "id": "uuid",
  "name": "My Project",
  "description": "Optional description",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}
```

#### Error (422 Validation Error)

```json
{
  "detail": [
    {
      "loc": ["body", "name"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}
```

---

## GET /projects/{id}

**Description:** Get project details.

### Response

#### Success (200 OK)

```json
{
  "id": "uuid",
  "name": "My Project",
  "description": "Project description",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}
```

#### Error (404 Not Found)

```json
{
  "detail": "Project not found"
}
```

---

## PUT /projects/{id}

**Description:** Update a project.

### Request

#### Request Body

```json
{
  "name": "Updated Name",
  "description": "Updated description"
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | `string` | No | New project name |
| `description` | `string` | No | New description |

### Response

#### Success (200 OK)

```json
{
  "id": "uuid",
  "name": "Updated Name",
  "description": "Updated description",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-02T00:00:00Z"
}
```

---

## DELETE /projects/{id}

**Description:** Delete a project and all associated repositories.

### Response

#### Success (204 No Content)

#### Error (404 Not Found)

```json
{
  "detail": "Project not found"
}
```

**Warning:** This also deletes all repositories and their data. Cannot be undone.
