# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from typing import Collection, FrozenSet


class TimeInterval:
    start: datetime
    end: datetime

    def __init__(self, start: datetime, end: datetime): ...

    def contains(self, moment: datetime) -> bool: ...

    def overlaps_with(self, other: TimeInterval) -> bool: ...

    def is_subset(self, other: TimeInterval) -> bool: ...

    def duration(self) -> timedelta: ...

    def is_empty(self) -> bool: ...

    def intersection(self, other: TimeInterval) -> TimeInterval: ...

    def translate(self, by: timedelta) -> TimeInterval: ...


class TimeSet:
    intervals: FrozenSet[TimeInterval]
    start: datetime
    end: datetime

    def __init__(self, intervals: Collection[TimeInterval]): ...

    @classmethod
    def from_interval(cls, start: datetime, end: datetime) -> TimeSet: ...

    @classmethod
    def empty(cls) -> TimeSet: ...

    def union(self, other: TimeSet) -> TimeSet: ...

    def intersection(self, other: TimeSet) -> TimeSet: ...

    def difference(self, other: TimeSet) -> TimeSet: ...

    def contains(self, moment: datetime) -> bool: ...

    def is_subset(self, other: TimeSet) -> bool: ...

    def is_empty(self) -> bool: ...

    def limiting_interval(self) -> TimeInterval: ...

    def duration(self) -> timedelta: ...
