# Noovera API Contracts

Type-safe API contracts for the Noovera platform. This package provides comprehensive TypeScript types, Zod schemas, and ts-rest contracts for building type-safe frontend applications.

## Features

- 🚀 **Type-Safe**: Full TypeScript support with strict typing
- 🔍 **Zod Validation**: Runtime validation with Zod schemas
- 🛠 **ts-rest Integration**: Ready-to-use API contracts
- 📦 **Tree-Shakable**: Optimized bundle size with tree-shaking
- 🤖 **Agentic Platform**: Built specifically for agentic customer support experiences

## Installation

```bash
npm install @noovera/contracts
# or
yarn add @noovera/contracts
# or
pnpm add @noovera/contracts
```

## Quick Start

### Basic Usage

```typescript
import { apiContract } from '@noovera/contracts';
import { initClient } from '@ts-rest/core';

// Initialize the API client
const client = initClient(apiContract, {
  baseUrl: 'https://api.noovera.ai',
  baseHeaders: {
    'Content-Type': 'application/json',
  },
});

// Use the client with full type safety
const conversations = await client.conversations.getConversations({
  query: {
    page: 1,
    limit: 10,
  },
});
```

### Using Individual Contracts

```typescript
import { agentsContract, authContract } from '@noovera/contracts';

// Use specific contracts
const agentsClient = initClient(agentsContract, { baseUrl: 'https://api.noovera.ai' });
const authClient = initClient(authContract, { baseUrl: 'https://api.noovera.ai' });
```

### Schema Validation

```typescript
import { CreateAgentRequestSchema } from '@noovera/contracts';

// Validate data at runtime
const agentData = CreateAgentRequestSchema.parse({
  name: 'Customer Support Agent',
  model: 'gpt-4',
  // ... other properties
});
```

## API Modules

### Core Resources

- **Agents**: AI agent management and configuration
- **Conversations**: Conversation management and messaging
- **Users**: User management and profiles
- **Organizations**: Multi-tenant organization support

### Authentication & Authorization

- **Auth**: User authentication and session management

### Business Intelligence

- **Analytics**: Data analytics and reporting
- **Audit**: Audit logging and tracking

### Integrations

- **Integrations**: Third-party service integrations

### Escalations

- **Escalations**: Human agent escalation workflows

## TypeScript Support

This package is built with TypeScript and provides comprehensive type definitions:

```typescript
import type { 
  Agent, 
  Conversation,
  ApiContract 
} from '@noovera/contracts';

// Use types for type safety
const agent: Agent = {
  name: 'My Agent',
  // ... other properties with full type checking
};
```

## Development

### Building

```bash
npm run build
```

### Type Checking

```bash
npm run type-check
```

### Validation

```bash
npm run validate
```

## Versioning

This package follows [Semantic Versioning](https://semver.org/):

- **MAJOR**: Breaking changes to the API contracts
- **MINOR**: New features and non-breaking additions
- **PATCH**: Bug fixes and minor improvements

## License

UNLICENSED - Proprietary software

---

Built with ❤️ by Noovera
