/invoices:
  get:
    tags:
    - invoice
    operationId: listInvoice
    security:
    - bearerAuth: []
    parameters:
    - $ref#limit: "./parameters/limit.yaml"
    - $ref#page: "./parameters/page.yaml"
    - name: customerName
      in: query
      description: filter by customerName
      schema:
        type: string
    responses:
      $ref#4xx: './responses/4xx.yaml'
      200:
        description: Invoice data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceQueryResult'

/invoices/generate:
  get:
    tags:
    - invoice
    operationId: generateInvoice
    security:
    - bearerAuth: []
    parameters:
    - $ref#limit: "./parameters/limit.yaml"
    - $ref#page: "./parameters/page.yaml"
    responses:
      $ref#4xx: './responses/4xx.yaml'
      200:
        description: Generate invoice
        content:
          application/json:
            schema:
              type: object
              properties: 
                message:
                  type: string

/invoices/export-pdf/{id}:
  get:
    tags:
      - invoice
    description: return invoice pdf
    operationId: getInvoicePdf
    security:
      - bearerAuth: []
    parameters:
      - $ref#id: "./parameters/objectid.yaml"
    responses:
      $ref#4xx: "./responses/4xx.yaml"
      200:
        description: template as pdf
        content:
          application/pdf:
            schema:
              type: string
              format: binary


/invoices/{id}:
  delete:
    tags:
    - invoice
    description: Delete a invoice with given id
    operationId: deleteInvoice
    security:
    - bearerAuth: []
    parameters:
    - $ref#id: './parameters/objectid.yaml'
    responses:
      $ref#4xx: './responses/4xx.yaml'
      $ref#204: './responses/204.yaml'


/invoices/generate/{id}:
  get:
    tags:
    - invoice
    description: Generate invoice by id
    operationId: generateInvoiceById
    security:
    - bearerAuth: []
    parameters:
    - $ref#id: './parameters/objectid.yaml'
    responses:
      $ref#4xx: './responses/4xx.yaml'
      200:
        description: invoice data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Invoice'
