# 3.1 Competition

The base Competition contract is an interface for tracking competition progression and results. It serves as the foundation for the other two competition types, enabling organizers to create and manage events with ease.

#### Function 1: start

```solidity
function start() public onlyOwner whenNotLive whenNotExpired
```

This function starts the competition.

| Name        | Type | Description |
| ----------- | ---- | ----------- |
| (no params) |      |             |

#### Function 2: setTeamNames

```solidity
function setTeamNames(string[] calldata _names) public onlyOwner whenNotLive
```

This function sets the team names in the competition.

| Name    | Type               | Description          |
| ------- | ------------------ | -------------------- |
| \_names | string\[] calldata | Array of team names. |

#### Function 3: completeMatch

```solidity
function completeMatch(uint256 _matchId, uint8 _winningTeamId) external onlyOwner whenInProgress
```

This function completes a match and records the winning team.

| Name            | Type    | Description                 |
| --------------- | ------- | --------------------------- |
| \_matchId       | uint256 | The ID of the match.        |
| \_winningTeamId | uint8   | The ID of the winning team. |

#### Function 4: advanceRound

```solidity
function advanceRound(uint8[] calldata _matchResults) public onlyOwner whenInProgress
```

This function advances the competition to the next round using the provided match results.

| Name           | Type              | Description                |
| -------------- | ----------------- | -------------------------- |
| \_matchResults | uint8\[] calldata | Array of winning team IDs. |

#### Function 5: advanceRound

```solidity
function advanceRound() public onlyOwner whenInProgress
```

This function advances the competition to the next round, assuming all matches are completed.

| Name        | Type | Description |
| ----------- | ---- | ----------- |
| (no params) |      |             |

#### Function 6: getCompetitionProgression

```solidity
function getCompetitionProgression() public view returns(MatchOutcome[] memory bracketProgress_)
```

This function returns the competition's bracket progression.

| Name              | Type                   | Description              |
| ----------------- | ---------------------- | ------------------------ |
| bracketProgress\_ | MatchOutcome\[] memory | Array of match outcomes. |

#### Function 7: getMatchOutcome

```solidity
function getMatchOutcome(uint256 _matchId) external view returns(MatchOutcome memory matchOutcome_)
```

This function returns the outcome of a specific match.

| Name           | Type                | Description          |
| -------------- | ------------------- | -------------------- |
| \_matchId      | uint256             | The ID of the match. |
| matchOutcome\_ | MatchOutcome memory | The match outcome.   |
