class WikiVersionRecorder < VersionRecorder
  def self.record! page:, event_type:, reason: nil, created_by_user:
    new(page:, event_type:, reason:, created_by_user:).record!
  end

  def initialize page:, event_type:, reason: nil, created_by_user:
    @reason = reason
    super(record: page, event_type:, created_by_user:)
  end

  private

  def version_class = WikiVersion
  def version_association = :wiki_versions
  def record_key = :wiki_page

  def snapshot_attributes = {
      title: @record.title,
      body: @record.body,
      reason: @reason }
end
