get:
  tags:
    - Deliveries
  summary: Get delivery details
  description: Returns a delivery data record including address and tracking information
  security:
    - ApiKeyAuth: []
  parameters:
    - name: delivery_id
      in: query
      required: true
      description: ID of the delivery to retrieve
      schema:
        type: integer
    - name: set_in_progress
      in: query
      required: false
      description: If true, marks the delivery as in progress if not already marked
      schema:
        type: boolean
        default: false
  responses:
    '200':
      description: Successful operation
      content:
        application/json:
          schema:
            type: object
            properties:
              delivery:
                type: object
                properties:
                  delivery_address:
                    type: object
                    properties:
                      title:
                        type: string
                        description: Academic or professional title
                      salutation:
                        type: string
                        description: Salutation (e.g. M for Mr)
                      company:
                        type: string
                        description: Company name
                      first_name:
                        type: string
                        description: First name
                      last_name:
                        type: string
                        description: Last name
                      street:
                        type: string
                        description: Street address
                      street2:
                        type: string
                        description: Additional address line
                      street_number:
                        type: string
                        description: Street number
                      city:
                        type: string
                        description: City name
                      state:
                        type: string
                        description: State/province
                      zipcode:
                        type: string
                        description: Postal/ZIP code
                      country:
                        type: string
                        description: Two-letter country code
                      email:
                        type: string
                        format: email
                        description: Email address
                      phone_no:
                        type: string
                        description: Phone number
                      tax_id:
                        type: string
                        description: Tax ID
                      country_name:
                        type: string
                        description: Full country name
                  delivery_type:
                    type: string
                    description: Type of delivery (e.g. shipping)
                  product_type_name:
                    type: string
                    description: Name of the product type
                  invoice_url:
                    type: string
                    format: uri
                    description: URL to download invoice PDF
                  delivery_slip_url:
                    type: string
                    format: uri
                    description: URL to download delivery slip PDF
                  tracking:
                    type: array
                    items:
                      type: object
                      properties:
                        delivery_id:
                          type: integer
                          description: Delivery ID
                        parcel_service_type:
                          type: string
                          description: Shipping service code
                        service_label:
                          type: string
                          description: Shipping service name
                        tracking_id:
                          type: string
                          description: Tracking number
                        tracking_url:
                          type: string
                          format: uri
                          description: URL to track shipment
                        quantity:
                          type: integer
                          description: Number of items in this shipment
                        ipn_config_id:
                          type: string
                          description: IPN configuration ID
                  quantity_total:
                    type: integer
                    description: Total quantity of items
                  id:
                    type: integer
                    description: Delivery ID
                  purchase_id:
                    type: string
                    description: Associated purchase ID
                  purchase_created_at:
                    type: string
                    format: date-time
                    description: Purchase creation timestamp
                  purchase_item_id:
                    type: integer
                    description: Purchase item ID
                  buyer_address_id:
                    type: integer
                    description: Buyer's address ID
                  type:
                    type: string
                    description: Record type
                  processed_at:
                    type: string
                    format: date-time
                    description: Processing timestamp
                  processed_by:
                    type: string
                    description: Processor identifier
                  product_id:
                    type: integer
                    description: Product ID
                  product_name:
                    type: string
                    description: Product name
                  product_type_id:
                    type: integer
                    description: Product type ID
                  variant_label:
                    type: string
                    description: Product variant label
                  variant_name:
                    type: string
                    description: Product variant name
                  variant_key:
                    type: string
                    description: Product variant key
                  variant_id:
                    type: integer
                    description: Product variant ID
                  quantity_delivered:
                    type: integer
                    description: Number of items delivered
                  is_shippment_by_reseller_id:
                    type: string
                    description: Reseller ID if shipped by reseller
                  is_test_order:
                    type: string
                    enum: ['Y', 'N']
                    description: Whether this is a test order
              is_set_in_progress:
                type: string
                enum: ['Y', 'N']
                description: Whether delivery was marked as in progress
              set_in_progress_fail_reason:
                type: string
                description: Reason why setting in progress failed, if applicable
    '401':
      description: Unauthorized - Invalid or missing API key
    '403':
      description: Forbidden - Insufficient access rights
    '404':
      description: Not found - Delivery with specified ID does not exist
