# Club configuration

Read and update every club setting in one operation.

Source: https://docs.champagne.dev-ukab.fr/fr/graphql/club-configuration

`clubConfiguration` returns, at once, the settings a club administrator edits in the back
office, and `updateClubConfiguration` changes any subset of them atomically. They suit
automation such as the [Terraform provider](/fr/terraform); the back office keeps using the
dedicated operations of each setting, which stay available.

Both operations require `settings_manage` in the club (club administrators and
[API tokens](/fr/graphql/api-tokens) hold it). Other callers receive `UNAUTHENTICATED`.

## Read the configuration [#read-the-configuration]

```graphql
query ClubConfiguration($clubId: ID! = "51000000-0000-4000-8000-000000000051") {
  clubConfiguration(clubId: $clubId) {
    clubId
    name
    description
    timezone
    hostedSlug
    address {
      line1
      line2
      postalCode
      city
      state
      country
    }
    billingEnabled
    credits {
      creditName
      creditsPerEuro
      lowBalanceThreshold
    }
    reservationGuestsRequireAccount
    depositRefundDays
    noShowSanctions {
      resetAfterDays
      rules {
        noShows
        action
        suspensionDays
      }
    }
  }
}
```

Returns null when the club does not exist. `name` is read-only here: only platform
administrators rename a club. `billingEnabled` is false when the platform turned the club's
`billing` module off.

## Update the configuration [#update-the-configuration]

```graphql
mutation UpdateClubConfiguration($input: ClubConfigurationInput!) {
  updateClubConfiguration(input: $input) {
    clubId
    timezone
    hostedSlug
  }
}
```

```json
{
  "input": {
    "clubId": "51000000-0000-4000-8000-000000000051",
    "timezone": "Europe/Paris",
    "hostedSlug": "ukab-clubs",
    "depositRefundDays": 7,
    "noShowSanctions": {
      "resetAfterDays": 90,
      "rules": [{ "noShows": 3, "action": "suspend", "suspensionDays": 14 }]
    }
  }
}
```

Only `clubId` is required. A field left out keeps its value. `description`, `hostedSlug` and
`address` are cleared by an explicit `null`; on any other field `null` also keeps the value.
Every provided setting is applied in one transaction: when one is refused, none is saved.
The mutation returns the configuration after the update.

| Field                             | Validation                                                                                  |
| --------------------------------- | ------------------------------------------------------------------------------------------- |
| `description`                     | Trimmed, at most 2,000 characters; blank is stored as null.                                 |
| `timezone`                        | A supported IANA zone or `UTC`.                                                             |
| `hostedSlug`                      | 3–63 lowercase letters, digits or hyphens, not reserved, unique across clubs.               |
| `address`                         | Same rules as [`updateClubAddress`](/fr/graphql/people#update-a-club-address).                 |
| `credits`                         | Same rules as [`configureCredits`](/fr/graphql/credits); refused when billing is off.          |
| `reservationGuestsRequireAccount` | Boolean.                                                                                    |
| `depositRefundDays`               | 0 to 365.                                                                                   |
| `noShowSanctions`                 | 1 to 3,650 reset days, at most 10 rules with distinct `noShows`; rules are returned sorted. |

Invalid values and refusals return `BAD_USER_INPUT` with a message; an unknown club returns
`This club is unavailable.` Each group of settings that actually changes is recorded in the
club activity under the action of its dedicated mutation.
