You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: order.rb
    path of file: ./repos/sequencescape/app/api/model_extensions
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
# Included in {Order}
# The intent of this file was to provide methods specific to the V1 API
module ModelExtensions::Order
  class RequestOptionForValidation < OpenStruct # rubocop:todo Style/OpenStructUse
    delegate :errors, :include_unset_values?, to: :owner
  end

  module Validations
    def self.included(base)
      base.class_eval do
        extend DelegateValidation
        delegate_validation :request_options_for_validation,
                            as: 'request_options',
                            to: :request_types,
                            if: :validate_request_options?
      end
    end

    # The validation of the request options should happen if we are leaving the building state, or if the
    # request options have been specified.  Once they are specified they are always checked, unless they are
    # completely blanked.
    def validate_request_options?
      not building? or reques
    
  def self.included(base) # rubocop:todo Metrics/AbcSize
    base.class_eval do
      include Validations

      before_validation :merge_in_structured_request_options

      scope :include_study, -> { includes(study: :uuid_object) }
      scope :include_project, -> { includes(project: :uuid_object) }
      scope :include_assets, -> { includes(assets: [:uuid_object, { aliquots: Io::Aliquot::PRELOADS }]) }

      has_many :submitted_assets, -> { joins(:asset) }, inverse_of: :order
      has_many :assets, through: :submitted_assets, before_add: :validate_new_record do
        def <<(associated)
          return super(associated) if associated.is_a?(Receptacle)

          Rails.logger.warn("#{associated.class.name} passed to order.assets")
          super(associated&.receptacle)
        end
      end

      scope :that_submitted_asset_id,
            ->(asset_id) { where(submitted_assets: { asset_id: asset_id }).joins(:submitted_assets) }

      validate :extended_validation
      def extended_validation
        extended_validators.reduce(true) { |valid, validator| validator.validate_order(self) && valid }
      end

      # The API can create submissions but we have to prevent someone from changing the study
      # and the project once they have been set.
      validates_each(:study, :project, on: :update) do |record, attr, _value|
        record.errors.add(attr, 'cannot be changed') if record.send(:"will_save_change_to_#{attr}_id?")
      end

      def extended_validators
        ExtendedValidator.for_submission(self)
      end
    end
  end