openapi: 3.0.0
info:
  title: Evolution Foundation - Evolution Go - Community
  description: Go implementation of Evolution
  version: '1.0'
servers:
- url: http://localhost:8080/
  description: Development server (HTTP)
- url: https://localhost:8080/
  description: Development server (HTTPS)
- url: '{customUrl}'
  description: Custom server
  variables:
    customUrl:
      default: https://your-instance.com
      description: Enter your server URL
paths:
  /community/add:
    post:
      description: Add participant to community
      summary: Add participant to community
      responses:
        '200':
          description: Participant added to community successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  failed: null
                  success:
                  - "120360000000000004@g.us"
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Participant information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/add
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/add
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to add participant to community
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/add
                  method: POST
        '404':
          description: Not Found - Community or participant not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Community or participant not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/add
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/add
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddParticipant'
        description: Participant data
  /community/create:
    post:
      description: Create community
      summary: Create community
      responses:
        '200':
          description: Community created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                  community:
                    type: object
              example:
                data:
                  JID: "120360000000000003@g.us"
                  OwnerJID: "100000000000001@lid"
                  OwnerPN: "5511999999999@s.whatsapp.net"
                  Name: "Community Name"
                  NameSetAt: "2026-01-15T10:30:00-03:00"
                  NameSetBy: "100000000000001@lid"
                  NameSetByPN: "5511999999999@s.whatsapp.net"
                  Topic: ""
                  TopicID: ""
                  TopicSetAt: "0001-01-01T00:00:00Z"
                  TopicSetBy: ""
                  TopicSetByPN: ""
                  TopicDeleted: false
                  IsLocked: false
                  IsAnnounce: false
                  AnnounceVersionID: ""
                  IsEphemeral: false
                  DisappearingTimer: 0
                  IsIncognito: false
                  IsParent: true
                  DefaultMembershipApprovalMode: "request_required"
                  LinkedParentJID: ""
                  IsDefaultSubGroup: false
                  IsJoinApprovalRequired: false
                  AddressingMode: "lid"
                  GroupCreated: "2026-01-15T10:30:00-03:00"
                  CreatorCountryCode: ""
                  ParticipantVersionID: ""
                  Participants:
                  - JID: "100000000000001@lid"
                    PhoneNumber: "5511999999999@s.whatsapp.net"
                    LID: "100000000000001@lid"
                    IsAdmin: true
                    IsSuperAdmin: true
                    DisplayName: ""
                    Error: 0
                    AddRequest: null
                  ParticipantCount: 0
                  MemberAddMode: "admin_add"
                  Suspended: false
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Community name is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/create
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/create
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to create community
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/create
                  method: POST
        '404':
          description: Not Found - Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Resource not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/create
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/create
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCommunity'
        description: Community data
  /community/remove:
    post:
      description: Remove participant from community
      summary: Remove participant from community
      responses:
        '200':
          description: Participant removed from community successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  failed: null
                  success:
                  - "120360000000000004@g.us"
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Participant information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/remove
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/remove
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to remove participant from community
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/remove
                  method: POST
        '404':
          description: Not Found - Community or participant not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Community or participant not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/remove
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /community/remove
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddParticipant'
        description: Participant data
components:
  schemas:
    AddParticipant:
      type: object
      properties:
        communityJid:
          type: string
        groupJid:
          items:
            type: string
          type: array
    CreateCommunity:
      type: object
      properties:
        communityName:
          type: string
    ErrorResponse:
      type: object
      required:
      - success
      - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
            message:
              type: string
        meta:
          type: object
          properties:
            timestamp:
              type: string
              format: date-time
            path:
              type: string
            method:
              type: string
