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: enju_basket.rb
    path of file: ./repos/enju_leaf/app/models/concerns/enju_circulation
    
    the code of the file until where you have to start completion: module EnjuCirculation
  module EnjuBasket
    extend ActiveSupport::Concern

    included do
      has_many :checked_items, dependent: :destroy
      has_many :items, through: :checked_items
      has_many :checkouts, dependent: :restrict_with_exception
      has_many :checkins, dependent: :restrict_with_exception
    end

    def basket_checkout(librarian)
      return nil if checked_items.size.zero?

      Item.transaction do
        checked_items.each do |checked_item|
          checkout = user.checkout
    
    def basket_checkout(librarian)
      return nil if checked_items.size.zero?

      Item.transaction do
        checked_items.each do |checked_item|
          checkout = user.checkouts.new
          checkout.librarian = librarian
          checkout.item = checked_item.item
          checkout.basket = self
          checkout.library = librarian.profile.library
          checkout.shelf = checked_item.item.shelf
          checkout.due_date = checked_item.due_date
          checked_item.item.checkout!(user)
          checkout.save!
        end
        CheckedItem.where(basket_id: id).destroy_all
      end
    end