resources:
  App\Entity\Contract:
    security: 'is_granted("ROLE_INTERNAL")'
    securityMessage: 'This operation is restricted to customers only. Please ensure you have the necessary permissions before proceeding.'
    normalizationContext:
      groups:
        - 'identifier:read'
        - 'time_trace:read'
        - 'contract:read'
        - 'media_file:read'

    denormalizationContext:
      groups:
        - 'contract:write'
        - 'media_file:write'
    operations:
      ApiPlatform\Metadata\GetCollection:
        filters: [ 'contract.order_filter', 'contract.search_filter' ]
        openapiContext:
          security:
            - JWT: [ 'ROLE_INTERNAL' ]
          summary: Contract - List - [INTERNAL USE ONLY].
          description: >
            Retrieves a list of Contract

      ApiPlatform\Metadata\Get:
        openapiContext:
          security:
            - JWT: [ 'ROLE_INTERNAL' ]
          summary: Contract - Item - [INTERNAL USE ONLY].
          description: >
            Retrieves a item of Contract

      contract_download:
        class: ApiPlatform\Metadata\Get
        security: 'is_granted("ROLE_CUSTOMER")'
        method: GET
        uriTemplate: /contracts/{id}/download
        controller: App\Controller\Api\Contract\DownloadController
        uriVariables: ['id']
        requirements:
          id: '\d+'
        openapiContext:
          security:
            - JWT: [ 'ROLE_CUSTOMER' ]
          summary: Download Contract - [INTERNAL USE ONLY].
          description: >
            Download Contract
        openapi:
          security:
            -   JWT: ['ROLE_CUSTOMER']

      ApiPlatform\Metadata\Post:
        security: 'is_granted("ROLE_ADMIN")'
        inputFormats:
          json: [ 'application/json' ]
          multipart: [ 'multipart/form-data' ]
        openapiContext:
          security:
            - JWT: [ 'ROLE_ADMIN' ]
          summary: Contract - Create - [INTERNAL USE ONLY].
          description: >
            create an item of Contract
            <br>
            <br>
            **[INTERNAL USE ONLY]**
            <br>
            This operation is restricted to internal systems and authorized personnel only.
            Please ensure you have the necessary permissions before proceeding.

      ApiPlatform\Metadata\Put:
        security: 'is_granted("ROLE_ADMIN")'
        inputFormats:
          json: [ 'application/json' ]
          multipart: [ 'multipart/form-data' ]
        openapiContext:
          summary: Contract - Update - [INTERNAL USE ONLY].
          description: >
            update an item of Contract
            <br>
            <br>
            **[INTERNAL USE ONLY]**
            <br>
            This operation is restricted to internal systems and authorized personnel only.
            Please ensure you have the necessary permissions before proceeding.
          security:
            - JWT: [ 'ROLE_ADMIN' ]

      ApiPlatform\Metadata\Delete:
        security: 'is_granted("ROLE_ADMIN")'
        openapiContext:
          summary: Contract - Delete.
          description: >
            delete an item of Contract
            <br>
            <br>
            **[INTERNAL USE ONLY]**
            <br>
            This operation is restricted to internal systems and authorized personnel only.
            Please ensure you have the necessary permissions before proceeding.
          security:
            - JWT: [ 'ROLE_ADMIN' ]
