class NicoTagVersionRecorder < VersionRecorder
  def self.record! tag:, event_type:, created_by_user:
    new(tag:, event_type:, created_by_user:).record!
  end

  def initialize tag:, event_type:, created_by_user:
    super(record: tag, event_type:, created_by_user:)
  end

  private

  def version_class = NicoTagVersion
  def version_association = :nico_tag_versions
  def record_key = :tag

  def snapshot_attributes
    { name: @record.name, linked_tags: @record.snapshot_linked_tag_names.join(' ') }
  end
end
