class T::Enum

def to_str

def to_str
  msg = 'Implicit conversion of Enum instances to strings is not allowed. Call #serialize instead.'
  if T::Configuration.legacy_t_enum_migration_mode?
    T::Configuration.soft_assert_handler(
      msg,
      storytime: {
        class: self.class.name,
        caller_location: Kernel.caller_locations(1..1)&.[](0)&.then {"#{_1.path}:#{_1.lineno}"},
      },
    )
    serialize.to_s
  else
    Kernel.raise NoMethodError.new(msg)
  end
end