import 'package:flutter/material.dart';
import 'package:sigap/src/features/personalization/presentasion/pages/settings/widgets/base_detail_screen.dart';

class TermsServicesScreen extends StatelessWidget {
  const TermsServicesScreen({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);

    return BaseDetailScreen(
      title: 'Terms and Services',
      content: ListView(
        padding: const EdgeInsets.all(20),
        children: [
          Text('Terms of Service', style: theme.textTheme.headlineSmall),
          const SizedBox(height: 15),
          Text(
            'Last updated: January 1, 2023',
            style: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor),
          ),
          const SizedBox(height: 25),
          _buildSectionText(
            context,
            'Introduction',
            'Welcome to SIGAP. These Terms of Service govern your use of our application and website. By using our services, you agree to these terms.',
          ),
          _buildSectionText(
            context,
            'Using Our Services',
            'You must follow any policies made available to you within the Services. You may use our Services only as permitted by law. We may suspend or stop providing our Services to you if you do not comply with our terms or policies or if we are investigating suspected misconduct.',
          ),
          _buildSectionText(
            context,
            'Privacy Policy',
            'Our privacy policy explains how we treat your personal data and protect your privacy when you use our Services. By using our Services, you agree that we can use such data in accordance with our privacy policy.',
          ),
          _buildSectionText(
            context,
            'About These Terms',
            'We may modify these terms or any additional terms that apply to a Service to, for example, reflect changes to the law or changes to our Services.',
          ),
          const SizedBox(height: 30),
          ElevatedButton(
            onPressed: () {},
            style: theme.elevatedButtonTheme.style,
            child: const Text('Download Full Terms'),
          ),
        ],
      ),
    );
  }

  Widget _buildSectionText(BuildContext context, String title, String content) {
    final theme = Theme.of(context);

    return Container(
      margin: const EdgeInsets.only(bottom: 20),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            title,
            style: theme.textTheme.titleMedium?.copyWith(
              fontWeight: FontWeight.bold,
            ),
          ),
          const SizedBox(height: 8),
          Text(
            content,
            style: theme.textTheme.bodyMedium?.copyWith(height: 1.5),
          ),
        ],
      ),
    );
  }
}
