You are given a code snippet that handles different scenarios to generate a link and a title based on the input `props`. The code snippet contains three conditional statements, each representing a different scenario. Your task is to implement a function that emulates the behavior of the code snippet and returns the generated link and title based on the given input.

You need to implement the following function:

```python
def generate_link_and_title(props):
    pass
```

**Input:**

- `props` (dictionary): A dictionary containing different properties. The properties that can be present in `props` are:
  - `performer` (dictionary): A dictionary representing a performer. It can have the following keys:
    - `name` (string): The name of the performer.
  - `movie` (dictionary): A dictionary representing a movie. It can have the following keys:
    - `name` (string): The name of the movie.
  - `marker` (dictionary): A dictionary representing a scene marker. It can have the following keys:
    - `title` (string): The title of the scene marker.
    - `primary_tag` (dictionary): A dictionary representing the primary tag of the scene marker. It can have the following keys:
      - `name` (string): The name of the primary tag.

**Output:**

- A tuple containing the generated link and title based on the input `props`.

**Notes:**

- If `props` contains both `performer` and `movie`, the link and title should be generated based on the `performer` scenario.
- If `props` contains both `movie` and `marker`, the link and title should be generated based on the `movie` scenario.
- If `props` contains only `marker`, the link and title should be generated based on the `marker` scenario.
- The link and title should be generated according to the following rules:
  - For the `performer` scenario: Use the `NavUtils.makePerformerScenesUrl` function to generate the link by passing `props.performer` as the argument. Use the `props.performer.name` as the title if it exists, otherwise use an empty string.
  - For the `movie` scenario: Use the `NavUtils.makeMovieScenesUrl` function to generate the link by passing `props.movie` as the argument. Use the `props.movie.name` as the title if it exists, otherwise use an empty string.
  - For the `marker` scenario: Use the `NavUtils.makeSceneMarkerUrl` function to generate the link by passing `props.marker` as the argument. Use `props.marker.title` as the title if it exists. If `props.marker.title` doesn't exist, use `props.marker.primary_tag.name` as the title if it exists. If neither `props.marker.title` nor `props.marker.primary_tag.name` exists, use an empty string as the title.
user
Sure, I can help you with implementing that function. Here's a Python 3 implementation based on your specifications.

```python
import NavUtils

def generate_link_and_title(props):
    # Check for performer and movie properties
    if 'performer' in props and 'movie' in props:
        # Use performer
        # Generate link
        performer_link = NavUtils.makePerformerScenesUrl(props['performer'])
        # Get title from performer if available
        performer_title = props['performer'].get('name', '')
        # Combine into tuple
        return performer_link, performer_title

    # Check for movie and marker properties
    if 'movie' in props and 'marker' in props:
        # Use movie
        # Generate link
        movie_link = NavUtils.makeMovieScenesUrl(props['movie'])
        # Get title from movie if available
        movie_title = props['movie'].get('name', '')
        # Combine into tuple
        return movie_link, movie_title

    # Use marker
    # Generate link
    marker_link = NavUtils.makeSceneMarkerUrl(props['marker'])
    # Get title from marker if available
    marker_title = props['marker'].get('title', props['marker'].get('primary_tag', {}).get('name', ''))
    # Combine into tuple
    return marker_link, marker_title

    # If none of the above conditions are satisfied
    raise ValueError('Invalid props given')
```

Note: This implementation assumes that `NavUtils` is a module or function that provides the necessary URL generation and title extraction functions. You'll need to replace this with your actual implementation/dependency. Also, the `generate_link_and_title` function returns a tuple, not a string, but you can modify it to return a string if necessary.
assistant
You are given a code snippet that handles different scenarios to generate a link and a title based on the input `props`. The code snippet contains three conditional statements, each representing a different scenario. Your task is to implement a function that emulates the behavior of the code snippet and returns the generated link and title based on the given input.

You need to implement the following function:

```python
def generate_link_and_title(props):
    pass
```

**Input:**

- `props` (dictionary): A dictionary containing different properties. The properties that can be present in `props` are:
  - `performer` (dictionary): A dictionary representing a performer. It can have the following keys:
    - `name` (string): The name of the performer.
  - `movie` (dictionary): A dictionary representing a movie. It can have the following keys:
    - `name` (string): The name of the movie.
  - `marker` (dictionary): A dictionary representing a scene marker. It can have the following keys:
    - `title` (string): The title of the scene marker.
    - `primary_tag` (dictionary): A dictionary representing the primary tag of the scene marker. It can have the following keys:
      - `name` (string): The name of the primary tag.

**Output:**

- A tuple containing the generated link and title based on the input `props`.

**Notes:**

- If `props` contains both `performer` and `movie`, the link and title should be generated based on the `performer` scenario.
- If `props` contains both `movie` and `marker`, the link and title should be generated based on the `movie` scenario.
- If `props` contains only `marker`, the link and title should be generated based on the `marker` scenario.
- The link and title should be generated according to the following rules:
  - For the `performer` scenario: Use the `NavUtils.makePerformerScenesUrl` function to generate the link by passing `props.performer` as the argument. Use the `props.performer.name` as the title if it exists, otherwise use an empty string.
  - For the `movie` scenario: Use the `NavUtils.makeMovieScenesUrl` function to generate the link by passing `props.movie` as the argument. Use the `props.movie.name` as the title if it exists, otherwise use an empty string.
  - For the `marker` scenario: Use the `NavUtils.makeSceneMarkerUrl` function to generate the link by passing `props.marker` as the argument. Use `props.marker.title` as the title if it exists. If `props.marker.title` doesn't exist, use `props.marker.primary_tag.name` as the title if it exists. If neither `props.marker.title` nor `props.marker.primary_tag.name` exists, use an empty string as the title.
user
Sure, I can help you implement the `generate_link_and_title` function based on the given instructions. However, please note that the `NavUtils` object is not defined in the context of your question, so I'll assume it's an external utility object that contains the methods `makePerformerScenesUrl`, `makeMovieScenesUrl`, and `makeSceneMarkerUrl`. Here's how you might implement the function:

```python
def generate_link_and_title(props):
    # Assuming NavUtils is an external utility object
    # Define the methods from NavUtils as placeholders
    NavUtils = {
        'makePerformerScenesUrl': lambda performer: f'/performer/{performer["name"]}',
        'makeMovieScenesUrl': lambda movie: f'/movie/{movie["name"]}',
        'makeSceneMarkerUrl': lambda marker: f'/marker/{marker.get("title", marker.get("primary_tag", {}).get("name", ""))}'
    }

    if 'performer' in props and 'movie' in props:
        link = NavUtils['makePerformerScenesUrl'](props['performer'])
        title = props['performer'].get('name', '')

    elif 'movie' in props and 'marker' in props:
        link = NavUtils['makeMovieScenesUrl'](props['movie'])
        title = props['movie'].get('name', '')

    elif 'marker' in props:
        link = NavUtils['makeSceneMarkerUrl'](props['marker'])
        title = props['marker'].get('title', props['marker'].get('primary_tag', {}).get('name', ''))

    else:
        link = ''
        title = ''

    return link, title
```

This function first defines the `NavUtils` methods as placeholders, then checks the conditions you provided to generate the link and title. If none of the conditions are met, it returns an empty string for both the link and the title.
assistant