---
import { getSettings, SettingKey } from '@util/settings.ts';
import { db } from '@db/database.ts';
import Signup from '@app/website/signup/Signup.astro';

const signupSetting = await getSettings(db, [
  SettingKey.SignupEnabled,
  SettingKey.SignupDisabledMessage,
  SettingKey.SignupDisabledSubMessage
]);
const signupEnabled = signupSetting[SettingKey.SignupEnabled] ?? false;
const signupDisabledMessage = signupSetting[SettingKey.SignupDisabledMessage] ?? 'Anmeldung deaktiviert';
const signupDisabledSubMessage = signupSetting[SettingKey.SignupDisabledSubMessage] ?? '';
---

<Signup
  signupDisabled={signupEnabled
    ? undefined
    : {
        message: signupDisabledMessage,
        subMessage: signupDisabledSubMessage
      }}
  }
/>
