asyncapi: '2.6.0'
info:
  title: 评论服务消息接口
  version: '1.0.0'
  description: 评论服务的事件消息定义，包含评论创建和状态变更事件

servers:
  production:
    url: nats://nats.nats:4222
    protocol: nats
    description: 生产环境 NATS 服务器

channels:
  comment.comments.created:
    publish:
      message:
        name: CommentCreated
        title: 评论创建事件
        summary: 当新评论被创建时触发
        payload:
          type: object
          required:
            - orderId
            - commentId
            - status
            - createTime
          properties:
            orderId:
              type: string
              description: 订单ID
            commentId:
              type: string
              description: 评论ID
            status:
              type: integer
              description: 评论状态
              enum: [1, 2, 3]
              x-enum-descriptions: ["待审核", "已审核", "已拒绝"]
            createTime:
              type: string
              format: date-time
              description: 评论创建时间
  comment.comments.statusChanged:
    publish:
      message:
        name: CommentStatusChanged
        title: 评论状态变更事件
        summary: 当评论状态发生变化时触发
        payload:
          type: object
          required:
            - orderId
            - commentId
            - oldStatus
            - newStatus
            - updateTime
          properties:
            orderId:
              type: integer
              description: 订单ID
            commentId:
              type: integer
              description: 评论ID
            oldStatus:
              type: integer
              description: 原评论状态
              enum: [1, 2, 3]
              x-enum-descriptions: ["待审核", "已审核", "已拒绝"]
            newStatus:
              type: integer
              description: 新评论状态
              enum: [1, 2, 3]
              x-enum-descriptions: ["待审核", "已审核", "已拒绝"]
            updateTime:
              type: string
              format: date-time
              description: 状态更新时间

components:
  schemas:
    CommentStatus:
      type: integer
      enum: [1, 2, 3]
      x-enum-descriptions: ["待审核", "已审核", "已拒绝"]
      description: 评论状态枚举
