apiVersion: v1
kind: ConfigMap
metadata:
  name: keycloak-realm-import
  labels:
    app: workclub-keycloak
data:
  realm-export.json: |
    {
      "realm": "workclub",
      "enabled": true,
      "displayName": "Work Club Manager",
      "registrationAllowed": false,
      "rememberMe": true,
      "verifyEmail": false,
      "loginWithEmailAllowed": true,
      "duplicateEmailsAllowed": false,
      "resetPasswordAllowed": true,
      "editUsernameAllowed": false,
      "bruteForceProtected": true,
      "clients": [
        {
          "clientId": "workclub-api",
          "name": "Work Club API",
          "enabled": true,
          "protocol": "openid-connect",
          "clientAuthenticatorType": "client-secret",
          "secret": "dev-secret-workclub-api-change-in-production",
          "redirectUris": [],
          "webOrigins": [],
          "publicClient": false,
          "directAccessGrantsEnabled": false,
          "serviceAccountsEnabled": false,
          "standardFlowEnabled": false,
          "implicitFlowEnabled": false,
          "fullScopeAllowed": true,
          "protocolMappers": [
            {
              "name": "audience-workclub-api",
              "protocol": "openid-connect",
              "protocolMapper": "oidc-audience-mapper",
              "consentRequired": false,
              "config": {
                "included.client.audience": "workclub-api",
                "id.token.claim": "false",
                "access.token.claim": "true"
              }
            },
            {
              "name": "clubs-claim",
              "protocol": "openid-connect",
              "protocolMapper": "oidc-usermodel-attribute-mapper",
              "consentRequired": false,
              "config": {
                "user.attribute": "clubs",
                "claim.name": "clubs",
                "jsonType.label": "String",
                "id.token.claim": "true",
                "access.token.claim": "true",
                "userinfo.token.claim": "true"
              }
            }
          ]
        },
        {
          "clientId": "workclub-app",
          "name": "Work Club Frontend",
          "enabled": true,
          "protocol": "openid-connect",
          "publicClient": true,
          "redirectUris": [
            "http://localhost:3000/*",
            "http://localhost:3001/*",
            "http://workclub-frontend/*",
            "http://192.168.240.200:30080/*"
          ],
          "webOrigins": [
            "http://localhost:3000",
            "http://localhost:3001",
            "http://workclub-frontend",
            "http://192.168.240.200:30080"
          ],
          "directAccessGrantsEnabled": true,
          "standardFlowEnabled": true,
          "implicitFlowEnabled": false,
          "fullScopeAllowed": true,
          "protocolMappers": [
            {
              "name": "audience-workclub-api",
              "protocol": "openid-connect",
              "protocolMapper": "oidc-audience-mapper",
              "consentRequired": false,
              "config": {
                "included.client.audience": "workclub-api",
                "id.token.claim": "false",
                "access.token.claim": "true"
              }
            },
            {
              "name": "clubs-claim",
              "protocol": "openid-connect",
              "protocolMapper": "oidc-usermodel-attribute-mapper",
              "consentRequired": false,
              "config": {
                "user.attribute": "clubs",
                "claim.name": "clubs",
                "jsonType.label": "String",
                "id.token.claim": "true",
                "access.token.claim": "true",
                "userinfo.token.claim": "true"
              }
            }
          ]
        }
      ],
      "roles": {
        "realm": [
          {
            "name": "admin",
            "description": "Club admin"
          },
          {
            "name": "manager",
            "description": "Club manager"
          },
          {
            "name": "member",
            "description": "Club member"
          },
          {
            "name": "viewer",
            "description": "Club viewer"
          }
        ]
      },
      "users": [
        {
          "username": "admin@test.com",
          "enabled": true,
          "email": "admin@test.com",
          "firstName": "Admin",
          "lastName": "User",
          "credentials": [
            {
              "type": "password",
              "value": "testpass123",
              "temporary": false
            }
          ],
          "realmRoles": [
            "admin"
          ],
          "attributes": {
            "clubs": [
              "64e05b5e-ef45-81d7-f2e8-3d14bd197383,Admin,3b4afcfa-1352-8fc7-b497-8ab52a0d5fda,Member"
            ]
          }
        },
        {
          "username": "manager@test.com",
          "enabled": true,
          "email": "manager@test.com",
          "firstName": "Manager",
          "lastName": "User",
          "credentials": [
            {
              "type": "password",
              "value": "testpass123",
              "temporary": false
            }
          ],
          "realmRoles": [
            "manager"
          ],
          "attributes": {
            "clubs": [
              "64e05b5e-ef45-81d7-f2e8-3d14bd197383,Manager"
            ]
          }
        },
        {
          "username": "member1@test.com",
          "enabled": true,
          "email": "member1@test.com",
          "firstName": "Member",
          "lastName": "One",
          "credentials": [
            {
              "type": "password",
              "value": "testpass123",
              "temporary": false
            }
          ],
          "realmRoles": [
            "member"
          ],
          "attributes": {
            "clubs": [
              "64e05b5e-ef45-81d7-f2e8-3d14bd197383,Member,3b4afcfa-1352-8fc7-b497-8ab52a0d5fda,Member"
            ]
          }
        },
        {
          "username": "member2@test.com",
          "enabled": true,
          "email": "member2@test.com",
          "firstName": "Member",
          "lastName": "Two",
          "credentials": [
            {
              "type": "password",
              "value": "testpass123",
              "temporary": false
            }
          ],
          "realmRoles": [
            "member"
          ],
          "attributes": {
            "clubs": [
              "64e05b5e-ef45-81d7-f2e8-3d14bd197383,Member"
            ]
          }
        },
        {
          "username": "viewer@test.com",
          "enabled": true,
          "email": "viewer@test.com",
          "firstName": "Viewer",
          "lastName": "User",
          "credentials": [
            {
              "type": "password",
              "value": "testpass123",
              "temporary": false
            }
          ],
          "realmRoles": [
            "viewer"
          ],
          "attributes": {
            "clubs": [
              "64e05b5e-ef45-81d7-f2e8-3d14bd197383,Viewer"
            ]
          }
        }
      ]
    }
