> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ugps.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuración de fases, mapeo y reglas de entrada



## OpenAPI

````yaml /generated/specs/sales.json get /api/v1/cases/config
openapi: 3.0.0
info:
  title: Raul API - Ventas
  description: >-
    Cotizaciones, pipeline, outreach comercial, equipos cotizables y ventas de
    equipamiento.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.raul.ugps.io
    description: Production
security: []
tags: []
paths:
  /api/v1/cases/config:
    get:
      tags:
        - cases
      summary: Configuración de fases, mapeo y reglas de entrada
      operationId: CaseBoardConfigController_config
      parameters: []
      responses:
        '200':
          description: >-
            Configuración vigente o semilla, con `warnings` de las etapas
            abiertas sin fase
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CaseBoardConfigViewDto'
        '403':
          description: Usuario con empresa (case_board_staff_only)
components:
  schemas:
    CaseBoardConfigViewDto:
      type: object
      properties:
        config:
          $ref: '#/components/schemas/CaseBoardConfigDto'
        isDefault:
          type: boolean
          description: '`true` si no hay configuración guardada (semilla)'
        updatedAt:
          type: string
          format: date-time
          nullable: true
          description: >-
            Revisión guardada; se reenvía en el PUT para detectar conflictos
            (409). `null` sin fila
        pipelines:
          type: array
          items:
            $ref: '#/components/schemas/CaseBoardPipelineViewDto'
        dueAlerts:
          $ref: '#/components/schemas/CaseDueAlertsDto'
        replyAlert:
          $ref: '#/components/schemas/CaseReplyAlertDto'
        waitingStages:
          $ref: '#/components/schemas/CaseWaitingStagesDto'
        mentionAlert:
          $ref: '#/components/schemas/CaseMentionAlertDto'
        activityTypes:
          type: array
          items:
            $ref: '#/components/schemas/CaseActivityTypeDto'
        warnings:
          description: >-
            Etapas abiertas sin fase en la configuración guardada; vacío en la
            semilla
          type: array
          items:
            $ref: '#/components/schemas/CaseBoardConfigWarningDto'
        defaults:
          description: Umbrales por defecto de las alertas del caso
          allOf:
            - $ref: '#/components/schemas/CaseAlertRulesDto'
      required:
        - config
        - isDefault
        - updatedAt
        - pipelines
        - dueAlerts
        - replyAlert
        - waitingStages
        - mentionAlert
        - activityTypes
        - warnings
        - defaults
    CaseBoardConfigDto:
      type: object
      properties:
        version:
          type: number
          enum:
            - 1
        columns:
          type: array
          items:
            $ref: '#/components/schemas/CaseBoardColumnDto'
        stageMap:
          type: object
          additionalProperties:
            type: string
          description: >-
            Fase por etapa: `<kind>:<pipelineId>:<stageId>` → id de fase; una
            etapa sin entrada usa el mapeo por defecto
        entryRules:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/CaseEntryRuleDto'
          description: 'Regla de entrada por pipeline: `<kind>:<pipelineId>`'
        dueAlerts:
          $ref: '#/components/schemas/CaseDueAlertsDto'
        replyAlert:
          $ref: '#/components/schemas/CaseReplyAlertDto'
        waitingStages:
          $ref: '#/components/schemas/CaseWaitingStagesDto'
        mentionAlert:
          $ref: '#/components/schemas/CaseMentionAlertDto'
      required:
        - version
        - columns
        - stageMap
        - entryRules
        - dueAlerts
        - replyAlert
        - waitingStages
        - mentionAlert
    CaseBoardPipelineViewDto:
      type: object
      properties:
        kind:
          type: string
          enum:
            - opportunity
            - ticket
        id:
          type: string
          format: uuid
        name:
          type: string
        isDefault:
          type: boolean
        stages:
          type: array
          items:
            $ref: '#/components/schemas/CaseStageDto'
        columnByStage:
          type: object
          additionalProperties:
            type: string
          description: Fase de cada etapa (id de etapa → id de fase) con el mapeo vigente
        entryRule:
          nullable: true
          type: object
          allOf:
            - $ref: '#/components/schemas/CaseEntryRuleDto'
      required:
        - kind
        - id
        - name
        - isDefault
        - stages
        - columnByStage
        - entryRule
    CaseDueAlertsDto:
      type: object
      properties:
        blinkSeconds:
          type: number
          description: >-
            Segundos de parpadeo de una tarjeta en alerta hasta que alguien
            actúe; la UI guarda 8 (encendido) o 0 (sólo color)
        default:
          $ref: '#/components/schemas/CaseDueAlertRuleDto'
        byType:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/CaseDueAlertRuleDto'
          description: >-
            Umbral por id de tipo de actividad de la tarea; la clave heredada
            `nextAction` se acepta pero ya no se aplica
      required:
        - blinkSeconds
        - default
        - byType
    CaseReplyAlertDto:
      type: object
      properties:
        warnHours:
          type: number
          description: Horas desde el mensaje del cliente para naranjo
        criticalHours:
          type: number
          description: Horas desde el mensaje del cliente para rojo
        windowDays:
          type: number
          nullable: true
          description: Días de mensajes que cuentan; `null` = sin límite
      required:
        - warnHours
        - criticalHours
        - windowDays
    CaseWaitingStagesDto:
      type: object
      properties:
        stageKeys:
          description: 'Etapas de espera de tickets: `ticket:<pipelineId>:<stageId>`'
          type: array
          items:
            type: string
        warnHours:
          type: number
          description: Horas hábiles en la etapa para naranjo
        criticalHours:
          type: number
          description: Horas hábiles en la etapa para rojo
      required:
        - stageKeys
        - warnHours
        - criticalHours
    CaseMentionAlertDto:
      type: object
      properties:
        warnHours:
          type: number
          description: Horas hábiles desde la mención para naranjo
        criticalHours:
          type: number
          description: Horas hábiles desde la mención para rojo
      required:
        - warnHours
        - criticalHours
    CaseActivityTypeDto:
      type: object
      properties:
        id:
          type: number
        name:
          type: string
      required:
        - id
        - name
    CaseBoardConfigWarningDto:
      type: object
      properties:
        key:
          type: string
          description: Clave de `stageMap` sin fase
        pipelineId:
          type: string
          format: uuid
        stageId:
          type: string
        stageName:
          type: string
      required:
        - key
        - pipelineId
        - stageId
        - stageName
    CaseAlertRulesDto:
      type: object
      properties:
        dueAlerts:
          $ref: '#/components/schemas/CaseDueAlertsDto'
        replyAlert:
          $ref: '#/components/schemas/CaseReplyAlertDto'
        waitingStages:
          $ref: '#/components/schemas/CaseWaitingStagesDto'
        mentionAlert:
          $ref: '#/components/schemas/CaseMentionAlertDto'
      required:
        - dueAlerts
        - replyAlert
        - waitingStages
        - mentionAlert
    CaseBoardColumnDto:
      type: object
      properties:
        id:
          type: string
          example: pending
        name:
          type: string
          example: Pendiente
        color:
          type: string
          example: '#F59E0B'
        order:
          type: number
        isFinal:
          type: boolean
          description: 'Fase de cerrados: sólo la usa la vista Lista'
      required:
        - id
        - name
        - color
        - order
        - isFinal
    CaseEntryRuleDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - minStageOrder
            - scheduledResume
          description: >-
            Sin `type` = `minStageOrder`. `scheduledResume` (sólo negocios)
            oculta el negocio hasta su reactivación programada
        minStageOrder:
          type: number
          description: Orden mínimo de etapa para entrar a Casos (`minStageOrder`)
    CaseStageDto:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        color:
          type: string
        order:
          type: number
        isFinal:
          type: boolean
        isWon:
          type: boolean
        isLost:
          type: boolean
        probability:
          type: number
          nullable: true
          description: >-
            Probabilidad de cierre de una etapa de negocios (0 a 1; ganada 1,
            perdida 0); `null` en tickets o sin configurar
      required:
        - id
        - name
        - color
        - order
        - isFinal
        - isWon
        - isLost
        - probability
    CaseDueAlertRuleDto:
      type: object
      properties:
        warnHours:
          type: number
          description: Horas antes del vencimiento para naranjo
        criticalHours:
          type: number
          description: Horas antes del vencimiento para rojo; 0 = al vencer
      required:
        - warnHours
        - criticalHours

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.