# ActivateChannel

## Permission Scope

marketplace

## Overview

ActivateChannel moves a draft Channel into ACTIVE status so it can participate in downstream commercial processing.

## Business Rules

- Only DRAFT Channel records may be activated.
- Channel type is required.
- Channel name must be unique enough to avoid operational ambiguity within the company.

## Process Flow

```mermaid
flowchart TD
    A[Receive activate request] --> B[Load Channel]
    B --> C{Status is DRAFT?}
    C -->|No| D[Return INVALID_CHANNEL_STATUS]
    C -->|Yes| E[Validate activation prerequisites]
    E --> F[Set status to ACTIVE]
    F --> G[Return activated Channel]
```

## External Dependencies

- [organization::GetCompany](../../../organization/docs/query/GetCompany.md) - Validate company scope for the channel.

## Error Scenarios

- **CHANNEL_NOT_FOUND**: Referenced channel does not exist
- **INVALID_CHANNEL_STATUS**: Channel status does not allow this operation
- **INVALID_CHANNEL_TYPE**: Channel type is missing or unsupported.
- **DUPLICATE_CHANNEL_NAME**: A conflicting channel name already exists.

## Test Cases

- activates a draft Channel
- throws when Channel is not in DRAFT status
- throws when Channel does not exist
- throws when the draft channel is missing a supported type
- throws when another channel already uses the same name
