class Reservation < ApplicationRecord
	self.primary_key = "reservation_id"

	#primary key - need to be unique generated for multiple shops
  	before_create :generate_custom_id

  	has_many :reservation_items

  	scope :active, -> { where("created_at BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") }

  	private
		def generate_custom_id
			self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "RS")
		end
end
