resources:
  App\Entity\User\Customer:
    normalizationContext:
      groups:
        - 'identifier:read'
        - 'time_trace:read'
        - 'user:read'
        - 'customer:read'
        - 'company_info:read'
        - 'company_info_update_request:read'
        - 'activity_info_update_request:read'
        - 'activity_area:read_essential'
        - 'activity_info:read'
        - 'customer_update_request:read'
        - 'media_file:read'

    denormalizationContext:
      groups:
        - 'user:write'
        - 'company_info:write'
        - 'activity_info:write'
        - 'customer:write'
        - 'media_file:write'
        - 'user:write'
        - 'time_trace:updated_at:write'

    operations:
      ApiPlatform\Metadata\GetCollection:
        filters: [ 'customer.order_filter', 'customer.search_filter', 'user.search_filter', 'user.global_search_filter', 'user.order_filter', 'user.name_search_filter', 'customer.boolean_filter']
        openapiContext:
          summary: Customer - List.
          description: >
            Retrieves a list of Customer

      ApiPlatform\Metadata\Get:
        openapiContext:
          summary: Customer - Item.
          description: >
            Retrieves a item of Customer

#      customer_credits:
#        class: ApiPlatform\Metadata\GetCollection
#        method: GET
#        uriTemplate: /customers/{id}/credits
#        output: App\Model\Credit\CreditOutput
#        provider: App\State\Provider\CustomerCreditsProvider
#        uriVariables: ['id']
#        requirements:
#          id: '\d+'
#        openapiContext:
#          summary: Retrieve Customer Credits.
#          description: >
#            Retrieve Customer Credits.

      ApiPlatform\Metadata\Put:
        security: 'is_granted("ROLE_INTERNAL") or is_granted("ROLE_API_KEY")'
        securityMessage: 'You are not authorized to access this resource.'
        inputFormats:
          json: [ 'application/json' ]
          multipart: [ 'multipart/form-data' ]
        openapiContext:
          summary: Customer - Update.
          description: >
            update an item of Customer

      put_contribution_up_to_date:
        security: 'is_granted("ROLE_INTERNAL") or is_granted("ROLE_API_KEY")'
        securityMessage: 'You are not authorized to access this resource.'
        class: ApiPlatform\Metadata\Put
        method: PUT
        uriTemplate: /customers/{id}/contribution-up-to-date
        uriVariables: ['id']
        requirements:
          id: '\d+'
        openapiContext:
          summary: Customer - Update contribution up to date field.
          description: >
            update the field contributionUpToDate of a Customer

        denormalizationContext:
          groups:
            - 'customer:contribution_up_to_date:write'

      ApiPlatform\Metadata\Delete:
        security: 'is_granted("ROLE_INTERNAL") or is_granted("ROLE_API_KEY")'
        securityMessage: 'You are not authorized to access this resource.'
        openapiContext:
          summary: Customer - Delete.
          description: >
            delete an item of Customer
