# typed: strict

class TimeWithoutZone < T::ImmutableStruct
  extend T::Sig
  include T::Struct::ActsAsComparable

  const :year, Integer
  const :month, Integer
  const :day, Integer
  const :hour, Integer
  const :minute, Integer
  const :second, Integer

  sig { params(zone: String).returns(Time) }
  def in_zone(zone)
    Time.use_zone(zone) { Time.new(year, month, day, hour, minute, second) }
  end

  sig { params(time: Time).returns(TimeWithoutZone) }
  def self.from_time(time)
    TimeWithoutZone.new(
      year: time.year,
      month: time.month,
      day: time.day,
      hour: time.hour,
      minute: time.min,
      second: time.sec,
    )
  end
end
