openapi: 3.0.3
info:
  title: Repzo API - Full Invoices
  version: 1.0.0
  description: OpenAPI specification for Repzo Full Invoices endpoints.
servers:
  - url: https://sv.api.repzo.me
paths:
  /fullinvoices:
    get:
      summary: Find full invoices
      operationId: findFullInvoices
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering full invoices
      responses:
        "200":
          description: A list of full invoices
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FullInvoiceFindResult"
    post:
      summary: Create a full invoice
      operationId: createFullInvoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FullInvoiceCreateBody"
      responses:
        "201":
          description: Full invoice created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FullInvoiceCreateResult"
  /fullinvoices/{id}:
    get:
      summary: Get a full invoice by ID
      operationId: getFullInvoice
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Full invoice details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FullInvoiceGetResult"
    put:
      summary: Update a full invoice
      operationId: updateFullInvoice
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FullInvoiceUpdateBody"
      responses:
        "200":
          description: Full invoice updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FullInvoiceUpdateResult"
components:
  schemas:
    FullInvoiceFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/FullInvoice"
        meta:
          type: object
    FullInvoiceCreateBody:
      type: object
      properties:
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        dueDate:
          type: string
          format: date-time
    FullInvoiceCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/FullInvoice"
    FullInvoiceGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/FullInvoice"
    FullInvoiceUpdateBody:
      type: object
      properties:
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        dueDate:
          type: string
          format: date-time
    FullInvoiceUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/FullInvoice"
    FullInvoice:
      type: object
      properties:
        _id:
          type: string
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        dueDate:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
