import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';

import 'package:krow_core/core.dart';
import '../widgets/get_started_page/get_started_actions.dart';
import '../widgets/get_started_page/get_started_background.dart';
import '../widgets/get_started_page/get_started_header.dart';

/// The entry point page for staff authentication.
///
/// This page provides the user with the initial options to either sign up
/// for a new account or log in to an existing one. It uses a series of
/// sub-widgets to maintain a clean and modular structure.
class GetStartedPage extends StatelessWidget {
  /// Creates a [GetStartedPage].
  const GetStartedPage({super.key});

  /// On sign up pressed callback.
  void onSignUpPressed() {
    Modular.to.toPhoneVerification('signup');
  }

  /// On login pressed callback.
  void onLoginPressed() {
    Modular.to.toPhoneVerification('login');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: <Widget>[
            // Background
            const Expanded(child: GetStartedBackground()),

            // Content Overlay
            Padding(
              padding: const EdgeInsets.all(UiConstants.space6),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.end,
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: <Widget>[
                  // Main text and actions
                  const GetStartedHeader(),

                  const SizedBox(height: UiConstants.space10),

                  // Actions
                  GetStartedActions(
                    onSignUpPressed: onSignUpPressed,
                    onLoginPressed: onLoginPressed,
                  ),

                  const SizedBox(height: UiConstants.space8),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
