class Sentry::Cron::MonitorConfig

def self.from_crontab(crontab, **options)

def self.from_crontab(crontab, **options)
  new(MonitorSchedule::Crontab.new(crontab), **options)
end

def self.from_interval(num, unit, **options)

def self.from_interval(num, unit, **options)
  return nil unless MonitorSchedule::Interval::VALID_UNITS.include?(unit)
  new(MonitorSchedule::Interval.new(num, unit), **options)
end

def initialize(schedule, checkin_margin: nil, max_runtime: nil, timezone: nil)

def initialize(schedule, checkin_margin: nil, max_runtime: nil, timezone: nil)
  @schedule = schedule
  @checkin_margin = checkin_margin
  @max_runtime = max_runtime
  @timezone = timezone
end

def to_hash

def to_hash
  {
    schedule: schedule.to_hash,
    checkin_margin: checkin_margin,
    max_runtime: max_runtime,
    timezone: timezone
  }.compact
end