openapi: 3.1.0
x-stoplight:
  id: s0ni3msbzyvji
info:
  version: 1.0.0
  title: Contractors Workers
  summary: API for contractors workers management
  description: >-
    The contractors_workers endpoint in the Nalanda API is designed to manage data about workers who are assigned to
    specific contractors. In this context, a contractor represents the relationship between a company and a project —
    essentially, a company contracted to perform work on a particular project.


    Each contractor can have one or more workers associated with them. These are the individuals who physically carry
    out the contracted work. This API allows systems to manage those workers effectively by supporting operations such
    as creating, updating, retrieving, and deleting worker records.


    This is particularly important for managing external or subcontracted personnel, where keeping accurate records is
    essential for legal compliance, labor audits, and operational tracking.
servers:
  - url: https://api.nalandaglobal.com/api
    description: Prod
paths:
  /contractors_workers:
    parameters: []
    get:
      summary: Get workers by contractor
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                minProperties: 0
                properties:
                  content:
                    type: array
                    x-stoplight:
                      id: 0acms5x259vq5
                    items:
                      $ref: '#/components/schemas/ContractorWorker'
                      x-stoplight:
                        id: apkeb1ewe1y5y
                  page:
                    $ref: ./Page.json
                    x-stoplight:
                      id: alvuk4s6ta9zk
        '400':
          $ref: '#/components/responses/400-Bad_Request'
        '401':
          $ref: '#/components/responses/401-Unauthorized'
        '403':
          $ref: '#/components/responses/403-Forbidden'
        '404':
          $ref: '#/components/responses/404-Not_Found'
        '406':
          $ref: '#/components/responses/406-Not_Acceptable'
      operationId: Get-workers-by-contractor
      x-stoplight:
        id: zeq1inf9nbbri
      description: |-
        <!-- BEGIN supported-platforms -->
        <!-- theme: none -->
        >#### Supported Platforms: NATIONAL / INTERNATIONAL
        <!-- END supported-platforms -->

        Service to consult all the workers of a subcontractor assigned to a project owned by the affiliated company.
        You must provide a contractor_id or worker_id_card to perform the search.
      x-supported-platforms:
        - national
        - international
      parameters:
        - schema:
            type: string
          in: query
          description: number of the current page
          name: page
        - schema:
            type: string
          in: query
          description: sort by field
          name: sort
        - schema:
            type: string
          in: query
          name: size
          description: size for every page
        - schema:
            type: string
          in: query
          name: contractor_id
          description: Id of a requested contractor
        - schema:
            type: string
          in: header
          name: Accept
          description: application/vnd.nalanda.api-v1.0+json
        - schema:
            type: string
          in: query
          name: worker_id_card
          description: IdCard of the requested worker
      tags:
        - Search
tags:
  - name: Search
    description: Search
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
  responses:
    401-Unauthorized:
      description: 401 Unauthorized
    404-Not_Found:
      description: 404 Not Found
      content:
        application/json:
          schema:
            $ref: ./Error.yaml
    406-Not_Acceptable:
      description: 406 Not Acceptable
      content: {}
    403-Forbidden:
      description: 403 Forbidden
      content:
        application/json:
          schema:
            $ref: ./Error.yaml
    400-Bad_Request:
      description: Example response
      content:
        application/json:
          schema:
            properties:
              id:
                type: string
  schemas:
    ContractorWorker:
      title: ContractorWorker
      x-stoplight:
        id: q5zjm99vbtoqt23
      type: object
      description: Contractor worker generic response
      required:
        - worker_id_card
        - contractor_id
      properties:
        id:
          type: string
          x-stoplight:
            id: dgg50m8iznuus
          description: indentifier
          example: 01HYWV218H22BAS7JN470NCXX2
        worker_id_card:
          type: string
          x-stoplight:
            id: eqr23pjkwas4al8yx
          example: 30921661R
          description: The id card of the worker
        contractor_id:
          type: string
          x-stoplight:
            id: srof96wgjrk9o
          description: The id contractor
          example: 01HA7B8SAVFAHR7BY8GAHXMHVD
        started_at:
          type: string
          x-stoplight:
            id: uczgbgmhjza41
          description: Date on which the supplier entered the project and started the work
          example: '2001-01-01'
          format: date
          pattern: ^\d{4}-\d{2}-\d{2}$
        finished_at:
          type: string
          x-stoplight:
            id: vmecdlaw1phxv
          pattern: ^\d{4}-\d{2}-\d{2}$
          format: date
          example: '2001-01-01'
          description: Date on which the supplier completed the work and left the project
    ContractorWorkerExtended:
      title: ContractorWorkerExtended
      x-stoplight:
        id: a6x8qfrjnnkxd
      type: object
      description: Contractor worker generic response
      required:
        - worker_id_card
        - contractor_id
      properties:
        id:
          type: string
          description: indentifier
          example: 01HYWV218H22BAS7JN470NCXX2
        worker_id_card:
          type: string
          example: 30921661R
          description: The id card of the worker
        contractor_id:
          type: string
          description: The id contractor
          example: 01HA7B8SAVFAHR7BY8GAHXMHVD
        started_at:
          type: string
          description: Date on which the supplier entered the project and started the work
          example: '2001-01-01'
          format: date
          pattern: ^\d{4}-\d{2}-\d{2}$
        finished_at:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          format: date
          example: '2001-01-01'
          description: Date on which the supplier completed the work and left the project
        working_days:
          type: string
          x-stoplight:
            id: p60vyb24q32vx
          description: Total number of days worked on that contract
        worker:
          type: object
          x-stoplight:
            id: x9yspy5yrj4bt
          properties:
            name:
              type: string
              x-stoplight:
                id: vnf94o75q7xkn
              description: Name of the worker
            last_name:
              type: string
              x-stoplight:
                id: umo7brrygjmbf
              description: Last name of the worker
            photo:
              type: string
              x-stoplight:
                id: gz9g5312x68fb
              description: Uri of the image resource
            type:
              type: string
              x-stoplight:
                id: x3y0u918n8vw1
              description: Type of the worker
            active:
              type: boolean
              x-stoplight:
                id: mihsrm0mx7j5r
              description: Wheter the worker is active or not
  parameters:
    page:
      name: page
      in: query
      required: false
      schema:
        type: number
      description: Number of the current page
    size:
      name: size
      in: query
      required: false
      schema:
        type: number
      description: Size for every page
    sort:
      name: sort
      in: query
      required: false
      schema:
        type: string
      description: Sort by field
    contentType: null
    name: Content-Type
    in: header
    required: false
    schema:
      type: string
    description: application/json
security:
  - bearerAuth: []
