# Notification SDK - Quick Usage Guide

## Installation
The SDK is already part of your `tm` module. Import it as:
```go
import "tm/pkg/notification"
```

## Basic Setup
```go
// 1. Configuration
config := notification.DefaultConfig()
config.BaseURL = "http://127.0.0.1:9095" // Your notification service URL

// 2. Logger (using project's logger)
loggerConfig := &logger.Config{Level: "info", Format: "json", Output: "stdout"}
projectLogger := logger.NewLogger(loggerConfig)
loggerAdapter := &notification.LoggerAdapter{Logger: projectLogger}

// 3. Create SDK
sdk, err := notification.NewSDK(config, loggerAdapter)
```

## Environment Variables
```bash
export NOTIFICATION_BASE_URL="http://127.0.0.1:9095"
export NOTIFICATION_TIMEOUT="30s"
export NOTIFICATION_RETRY_ATTEMPTS="3"
export NOTIFICATION_RETRY_DELAY="2s"
export NOTIFICATION_ENABLE_LOGGING="true"
```

## Quick Examples

### Simple Email
```go
err := sdk.QuickEmail(ctx, "user@example.com", "Hello!")
```

### Custom Notification
```go
request := &notification.NotificationRequest{
    EventType: notification.EventTypeEmail,
    Message:   "Hello Nima",
    Methods: notification.NotificationMethods{
        OTP:   "09143257416",
        SMS:   "09143257416", 
        Push:  "devicefsdgsdgsg6766sdgdsg",
        Email: "nakhostin.nima1998@gmail.com",
    },
    UserID: "",
}
response, err := sdk.SendNotification(ctx, request)
```

### Fluent Builder
```go
response, err := sdk.NewBuilder().
    SetEventType(notification.EventTypeEmail).
    SetMessage("Hello Nima").
    SetEmail("nakhostin.nima1998@gmail.com").
    Send(ctx)
```

### Batch Operations
```go
requests := []*notification.NotificationRequest{...}
batchResponse, err := sdk.SendBatch(ctx, requests)
```

## API Response
- **Success**: `{"status": "Notification sent"}`
- **Error**: `{"error": "error message"}`

## Error Handling
```go
if err != nil {
    switch e := err.(type) {
    case notification.ErrHTTP:
        // HTTP error (400, 500, etc.)
    case notification.ErrValidation:
        // Validation error
    case notification.ErrRetryExhausted:
        // All retry attempts failed
    }
}
``` 