class Fluent::Counter::HashValidator

def validate_name!(hash)

def validate_name!(hash)
  name = hash['name']
  unless name
    raise Fluent::Counter::InvalidParams.new('`name` is required')
  end
  unless name.is_a?(String)
    raise Fluent::Counter::InvalidParams.new('The type of `name` should be String')
  end
  unless VALID_NAME =~ name
    raise Fluent::Counter::InvalidParams.new("`name` is the invalid format")
  end
end

def validate_reset_interval!(hash)

def validate_reset_interval!(hash)
  interval = hash['reset_interval']
  unless interval
    raise Fluent::Counter::InvalidParams.new('`reset_interval` is required')
  end
  unless interval.is_a?(Numeric)
    raise Fluent::Counter::InvalidParams.new('The type of `reset_interval` should be Numeric')
  end
  if interval < 0
    raise Fluent::Counter::InvalidParams.new('`reset_interval` should be a positive number')
  end
end

def validate_value!(hash)

def validate_value!(hash)
  value = hash['value']
  unless value
    raise Fluent::Counter::InvalidParams.new('`value` is required')
  end
  unless value.is_a?(Numeric)
    raise Fluent::Counter::InvalidParams.new("The type of `value` type should be Numeric")
  end
end