private function transactionOptions(array &$options, array $previous = [])
    {
        $options += [
            'begin' => false,
            'transactionType' => SessionPoolInterface::CONTEXT_READWRITE,
            'transactionId' => null,
        ];

        $type = null;

        $context = $this->pluck('transactionType', $options);
        $id = $this->pluck('transactionId', $options);

        $begin = $this->pluck('begin', $options);
        if ($id === null) {
            if ($begin) {
                $type = 'begin';
            } else {
                $type = 'singleUseTransaction';
                $options['singleUse'] = true;
            }
        }

        if ($id !== null) {
            $type = 'transactionId';
            $transactionOptions = $id;
        } elseif ($context === SessionPoolInterface::CONTEXT_READ) {
            $transactionOptions = $this->configureSnapshotOptions($options, $previous);
        } elseif ($context === SessionPoolInterface::CONTEXT_READWRITE) {
            $transactionOptions = $this->configureTransactionOptions();
        } else {
            throw new \BadMethodCallException(sprintf(
                'Invalid transaction context %s',
                $context
            ));
        }

        return [$transactionOptions, $type, $context];
    }