public static function validateOptions(array $options): array
    {
        foreach ($options as $option => $value) {
            switch ($option) {
                case Scheduler::OPTION_AT:
                case Scheduler::OPTION_INTERVAL:
                case Scheduler::OPTION_RETRY:
                case Scheduler::OPTION_RETRY_INTERVAL:
                case Scheduler::OPTION_TIMEOUT:
                    if (!is_int($value)) {
                        throw new InvalidArgumentException('option '.$option.' must be an integer');
                    }

                break;
                case Scheduler::OPTION_IGNORE_DATA:
                case Scheduler::OPTION_FORCE_SPAWN:
                    if (!is_bool($value)) {
                        throw new InvalidArgumentException('option '.$option.' must be a boolean');
                    }

                break;
                case Scheduler::OPTION_ID:
                    if (!$value instanceof ObjectId) {
                        throw new InvalidArgumentException('option '.$option.' must be a an instance of '.ObjectId::class);
                    }

                break;
                default:
                    throw new InvalidArgumentException('invalid option '.$option.' given');
            }
        }

        return $options;
    }