{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": { "display": "flex", "align-items": "center" },
  "children": [
    {
      "elmType": "span",
      "txtContent": "@currentField",
      "style": {
        "display": "=if(@currentField == '', 'none', 'inline-block')",
        "white-space": "nowrap",
        "padding": "2px 10px",
        "border-radius": "12px",
        "font-weight": "600"
      },
      "attributes": {
        "class": "=if(@currentField == 'Validé', 'sp-css-backgroundColor-BgMintGreen sp-css-color-MintGreenFont', if(@currentField == 'En relecture', 'sp-css-backgroundColor-BgGold sp-css-color-GoldFont', if(@currentField == 'Brouillon', 'sp-css-backgroundColor-BgCornflowerBlue sp-css-color-CornflowerBlueFont', 'sp-css-backgroundColor-BgLightGray sp-css-color-LightGrayFont')))"
      }
    },
    {
      "elmType": "button",
      "txtContent": "Valider",
      "customRowAction": {
        "action": "setValue",
        "actionInput": { "Statut": "Validé" }
      },
      "attributes": {
        "class": "ms-fontColor-themePrimary ms-bgColor-themeLighter--hover"
      },
      "style": {
        "display": "=if(@currentField == 'En relecture', 'inline-flex', 'none')",
        "white-space": "nowrap",
        "margin-left": "8px",
        "padding": "2px 8px",
        "border": "1px solid",
        "border-radius": "4px",
        "background-color": "transparent",
        "cursor": "pointer"
      }
    }
  ]
}
