dto_generator:
  entities:
    api:
      XCart\API\Entity\Storefront\Cart:
        name: Storefront Cart
        logicEntity: XCart\Logic\Entity\Storefront\Cart
        path: /storefront/carts
        register_get_one: true
        register_create_one: true
        register_update_one: true
        register_delete_one: true
        idType: uuid4
        fields:
          email:
            type: string
            groups: [read]
          items:
            type: XCart\API\Entity\Storefront\Cart\Item[]
            groups: [read]
          subTotal:
            type: float
            groups: [read]
          total:
            type: float
            groups: [read]
          payment:
            type: XCart\API\Entity\Storefront\Cart\PaymentMethod
            groups: [read]
            nullable: true
          paymentTransaction:
            type: string
            groups: [read]
            nullable: true
          shipping:
            type: XCart\API\Entity\Storefront\Cart\ShippingMethod
            groups: [read]
            nullable: true
          surcharges:
            type: XCart\API\Entity\Storefront\Cart\Surcharge[]
            groups: [read]

      XCart\API\Entity\Storefront\Cart\Item:
        name: Cart item
        logicEntity: XCart\Logic\Entity\Storefront\Cart\Item
        path: /storefront/carts/{cart_id}/items
        register_get_one: true
        register_get_collection: true
        register_create_one: true
        register_update_one: true
        register_delete_one: true
        fields:
          productId:
            type: integer
            groups: [read, insert]
            annotations:
              Assert\NotBlank: ~
          sku:
            type: string
            groups: [read]
          name:
            type: string
            groups: [read]
          cleanUrl:
            type: string
            groups: [read]
          amount:
            type: float
            annotations:
              Assert\NotBlank: ~
          inStock:
            type: integer
            groups: [read]
          price:
            type: float
            groups: [read]
          clear_price:
            type: float
            groups: [read]
          net_price:
            type: float
            groups: [read]
          display_price:
            type: float
            groups: [read]
          attributes:
            type: XCart\Logic\Entity\Storefront\Cart\Item\AttributeValue[]
          surcharges:
            type: XCart\Logic\Entity\Storefront\Cart\Item\Surcharge[]
            groups: [read]
          subtotal:
            type: float
            groups: [read]
          total:
            type: float
            groups: [read]
          images:
            type: XCart\API\Entity\Storefront\Image[]
            groups: [read]

      XCart\API\Entity\Storefront\Cart\PaymentMethod:
        name: Payment method
        logicEntity: XCart\Logic\Entity\Storefront\Cart\PaymentMethod
        path: /storefront/carts/{cart_id}/payment_methods
        register_get_one: true
        register_get_collection: true
        fields:
          cartId:
            type: string
            groups: [empty]
          serviceName:
            type: string
          name:
            type: string
          title:
            type: string
          description:
            type: string
          instruction:
            type: string

      XCart\API\Entity\Storefront\Cart\CalculatedShippingRates:
        name: Calculated shipping rates
        logicEntity: XCart\Logic\Entity\Storefront\Cart\CalculatedShippingRates
        path: /storefront/carts/{cart_id}/calculatedShippingRates
        register_create_one: true
        idType: uuid4
        fields:
          rates:
            type: XCart\API\Entity\Storefront\Cart\ShippingRate[]
            groups: [read]
        annotations:
          - _: ApiResource
            collectionOperations:
              post:
                method: POST
                path: /storefront/carts/{cart_id}/calculatedShippingRates.{_format}
                denormalization_context:
                  groups: [insert]
                openapi_context:
                  summary: Calculated shipping rates

      XCart\API\Entity\Storefront\Cart\MergeRequest:
        name: Cart merge request
        logicEntity: XCart\Logic\Entity\Storefront\Cart\MergeRequest
        path: /storefront/carts/{cart_id}/merge
        register_create_one: true
        idType: uuid4
        fields:
          anonymousCartId:
            type: string
            groups: [insert]
            annotations:
              Assert\NotBlank: ~
        annotations:
          - _: ApiResource
            collectionOperations:
              post:
                method: POST
                path: /storefront/carts/{cart_id}/merge.{_format}
                denormalization_context:
                  groups: [insert]
                openapi_context:
                  summary: Cart merge request

      XCart\API\Entity\Storefront\Cart\ShippingMethodSelection:
        name: Cart shipping method selection
        logicEntity: XCart\Logic\Entity\Storefront\Cart\ShippingMethodSelection
        path: /storefront/carts/{cart_id}/select_shipping_method
        register_create_one: true
        idType: uuid4
        fields:
          shippingMethodId:
            type: integer
            annotations:
              Assert\NotBlank: ~
        annotations:
          - _: ApiResource
            collectionOperations:
              post:
                method: POST
                path: /storefront/carts/{cart_id}/select_shipping_method.{_format}
                denormalization_context:
                  groups: [insert]
                openapi_context:
                  summary: Cart shipping method selection

      XCart\API\Entity\Storefront\Cart\PaymentMethodSelection:
        name: Cart payment method selection
        logicEntity: XCart\Logic\Entity\Storefront\Cart\PaymentMethodSelection
        path: /storefront/carts/{cart_id}/select_payment_method
        register_create_one: true
        idType: uuid4
        fields:
          paymentMethodId:
            type: integer
            annotations:
              Assert\NotBlank: ~
        annotations:
          - _: ApiResource
            collectionOperations:
              post:
                method: POST
                path: /storefront/carts/{cart_id}/select_payment_method.{_format}
                denormalization_context:
                  groups: [insert]
                openapi_context:
                  summary: Cart payment method selection

      XCart\API\Entity\Storefront\Cart\EmailChanging:
        name: Cart email change
        logicEntity: XCart\Logic\Entity\Storefront\Cart\EmailChanging
        path: /storefront/carts/{cart_id}/change_email
        register_create_one: true
        idType: uuid4
        fields:
          email:
            type: string
            annotations:
              Assert\Email: ~
        annotations:
          - _: ApiResource
            collectionOperations:
              post:
                method: POST
                path: /storefront/carts/{cart_id}/change_email.{_format}
                denormalization_context:
                  groups: [insert]
                openapi_context:
                  summary: Cart email change

      XCart\API\Entity\Storefront\Order:
        name: Order
        logicEntity: XCart\Logic\Entity\Storefront\Order
        path: /storefront/carts/{cart_id}/order
        register_create_one: true
        fields:
          cartPublicId:
            type: string
            groups: [empty]
          number:
            type: string
            groups: [read]

    dto:
      XCart\API\Entity\Storefront\Cart\Item\AttributeValue:
        fields:
          name:
            type: string
            nullable: true
            groups: [read]
          attributeId:
            type: integer
          attributeValueId:
            type: integer
            nullable: true
          attributeValue:
            type: string
            nullable: true

      XCart\API\Entity\Storefront\Cart\Surcharge:
        fields:
          type:
            type: string
          name:
            type: string
          value:
            type: float

      XCart\API\Entity\Storefront\Cart\Item\Surcharge:
        fields:
          type:
            type: string
          name:
            type: string
          value:
            type: float

      XCart\API\Entity\Storefront\Cart\ShippingMethod:
        fields:
          id:
            type: integer
          name:
            type: string

      XCart\API\Entity\Storefront\Cart\ShippingRate:
        fields:
          method:
            type: XCart\API\Entity\Storefront\Cart\ShippingMethod
          value:
            type: float
          preparedDeliveryTime:
            type: string
            nullable: true
