# ProjectService

Accessible via `iam.projects`. Manages projects within tenants.

## Search Projects

```typescript
// Search all projects
const result = await iam.projects.search({});

// Search filtered by tenant
const result = await iam.projects.search({
  tenantIds: ['tid1'],
  keyword: 'web'
});

// Access results
result.projects.content; // Project[]
result.projects.totalElements; // Total number of results
result.projects.totalPages; // Total number of pages
result.projects.number; // Current page
result.projects.size; // Page size
```

### Search parameters

| Parameter   | Type                    | Description            |
| ----------- | ----------------------- | ---------------------- |
| `tenantIds` | `string[]`              | Filter by tenant IDs   |
| `keyword`   | `string`                | Free-text search       |
| `pageable`  | `{ page, rowsPerPage }` | Pagination (0-indexed) |

## Get Single Project

```typescript
const { project } = await iam.projects.getById('project-id');
const { project } = await iam.projects.getByCode('project-code', 'optional-tenant-id');
```

## Register Project

```typescript
const { id } = await iam.projects.register({
  code: 'my-project',
  name: 'My Project',
  tenantIds: ['tid1'], // optional
  roles: ['ROLE_USER'], // optional
  metadata: { env: 'production' }, // optional
  apiKey: 'project-api-key' // optional
});
```

## Import Project

Creates a project with an optional predefined ID.

```typescript
await iam.projects.importProject({
  id: 'custom-id', // optional
  code: 'imported',
  name: 'Imported Project',
  tenantIds: ['tid1'], // optional
  roles: [], // optional
  metadata: {}, // optional
  apiKey: 'key' // optional
});
```

## Update Project

```typescript
await iam.projects.update({
  projectId: 'project-id',
  name: 'New Name', // optional
  code: 'new-code', // optional
  roles: ['ROLE_USER'], // optional
  metadata: { env: 'staging' } // optional
});
```

## Delete Project

```typescript
await iam.projects.delete('project-id');
```
