import React from 'react';
import { Box, Button, Card, CardContent, Divider, Stack, Typography } from '@mui/material';
import { Link as RouterLink } from 'react-router-dom';

/**
 * Public Play / App Store account-deletion instructions (#103).
 * No auth required — reviewers and signed-out users must be able to read this page.
 */
const AccountDeletionPage = (): JSX.Element => (
  <Box sx={{ py: 4, px: 2, minHeight: '100vh', bgcolor: 'background.default' }}>
    <Card sx={{ maxWidth: 900, mx: 'auto', width: '100%' }}>
      <CardContent>
        <Typography variant="h3" component="h1" gutterBottom>
          Hesychia — Request account deletion
        </Typography>
        <Typography variant="subtitle1" color="text.secondary" gutterBottom>
          Hesychia (ai.hesychia.chat) · hesychia.ai · AI ML Operations, LLC
        </Typography>
        <Typography variant="body1" color="text.secondary">
          Use the steps below to request deletion of your Hesychia account. This page does not
          require sign-in to read.
        </Typography>
      </CardContent>

      <Divider />

      <CardContent>
        <Stack spacing={3}>
          <Box>
            <Typography variant="h5" component="h2" gutterBottom>
              How to delete your account
            </Typography>
            <Typography variant="body1" component="ol" sx={{ pl: 2.5, m: 0 }}>
              <li>
                Open <strong>Hesychia</strong> in the mobile app or at{' '}
                <a href="https://hesychia.ai" rel="noopener noreferrer">
                  hesychia.ai
                </a>
                .
              </li>
              <li>Sign in with the account you want deleted.</li>
              <li>
                Go to <strong>Account</strong>.
              </li>
              <li>
                Choose <strong>Delete my account</strong>, then confirm by typing your account
                email.
              </li>
            </Typography>
          </Box>

          <Box>
            <Typography variant="h5" component="h2" gutterBottom>
              What happens when you delete
            </Typography>

            <Typography variant="h6" component="h3" gutterBottom sx={{ mt: 2 }}>
              Deactivated immediately
            </Typography>
            <Typography variant="body1" component="ul" sx={{ pl: 2.5, m: 0 }}>
              <li>Your account is marked deleted and set inactive.</li>
              <li>You lose access to Hesychia and cannot sign in again with that account.</li>
              <li>Your conversations are hidden from the product.</li>
              <li>Active sessions are invalidated (refresh tokens are blacklisted).</li>
            </Typography>

            <Typography variant="h6" component="h3" gutterBottom sx={{ mt: 2 }}>
              Data retained after soft-delete
            </Typography>
            <Typography variant="body1" paragraph>
              Hesychia currently uses a <strong>soft-delete</strong> process. After you delete your
              account, personal data associated with the account (including profile details,
              conversation content, uploaded documents / RAG vectors, and authentication event
              records) may remain in our systems for administration, security, and audit purposes.
              This is not a full erasure of all stored data.
            </Typography>

            <Typography variant="h6" component="h3" gutterBottom>
              Retention period
            </Typography>
            <Typography variant="body1" paragraph sx={{ mb: 0 }}>
              There is currently <strong>no automatic hard-purge schedule</strong>. Soft-deleted
              data is retained until a future purge process is implemented or until we process a
              separate retention / erasure request through the contact path below. We will not claim
              complete erasure while soft-delete-only remains in effect.
            </Typography>
          </Box>

          <Box>
            <Typography variant="h5" component="h2" gutterBottom>
              Cannot access your account?
            </Typography>
            <Typography variant="body1" paragraph>
              If you cannot sign in to complete in-app deletion, contact AI ML Operations, LLC via{' '}
              <a href="https://www.aimloperations.com" rel="noopener noreferrer">
                aimloperations.com
              </a>{' '}
              and include the email address used for your Hesychia account. We aim to respond to
              account-deletion requests within <strong>30 days</strong>.
            </Typography>
            <Typography variant="body2" color="text.secondary">
              Staff accounts cannot self-delete in the app; use the contact path above.
            </Typography>
          </Box>
        </Stack>
      </CardContent>

      <Divider />

      <CardContent>
        <Typography variant="body2" color="text.secondary">
          Already have an account?{' '}
          <Button component={RouterLink} to="/signin/" size="small">
            Sign in
          </Button>{' '}
          ·{' '}
          <Button component={RouterLink} to="/account/" size="small">
            Account
          </Button>{' '}
          ·{' '}
          <Button component={RouterLink} to="/terms_of_service/" size="small">
            Terms of Service
          </Button>
        </Typography>
      </CardContent>
    </Card>
  </Box>
);

export default AccountDeletionPage;
