<?php
$clients = [
    [
        'title' => 'Getting Started for Web',
        'description' => 'Build Web apps with Appwrite.',
        'logo' => '/images/clients/web.png',
        'link' => '/docs/getting-started-for-web',
    ],
    [
        'title' => 'Getting Started for Flutter',
        'description' => 'Build Flutter apps with Appwrite.',
        'logo' => '/images/clients/flutter.png',
        'link' => '/docs/getting-started-for-flutter',
    ],
    [
        'title' => 'Getting Started for Apple',
        'description' => 'Build iOS apps with Appwrite.',
        'logo' => '/images/clients/apple.png',
        'link' => '/docs/getting-started-for-apple',
    ],
    [
        'title' => 'Getting Started for Android',
        'description' => 'Build Android apps with Appwrite.',
        'logo' => '/images/clients/android.png',
        'link' => '/docs/getting-started-for-android',
    ],
    /*[
        'title' => 'Unity',
        'logo' => '/images/clients/unity.png',
        'description' => 'Integrate Appwrite with your Unity project.',
        'link' => '/docs/getting-started-for-unity',
    ],*/
    [
        'title' => 'Getting Started for Servers',
        'description' => 'Integrate Appwrite with your backend.',
        'logo' => '/images/clients/servers.png',
        'link' => '/docs/getting-started-for-server',
    ],
    [
        'title' => 'Command Line',
        'description' => 'Integrate Appwrite from your terminal or CI.',
        'logo' => '/images/clients/terminal.png',
        'link' => '/docs/command-line',
    ],
];

$latestVersion = $this->getParam('latestVersion', 'latest');

$getSpecsUrl = function($type, $platform) use ($latestVersion) {
    // $type is 'swagger2' or 'open-api3'
    // $platform is 'client' or 'server'

    return 'https://github.com/appwrite/appwrite/blob/master/app/config/specs/' . $type . '-' . $latestVersion . '-' . $platform . '.json';
}

?>

<div class="zone xxl">

    <p class="margin-bottom">This documentation contains all the information you need to start building Web, Flutter, Android, or iOS apps with Appwrite. You can also review the complete and detailed API references to our services, tools, and features.</p>
    
    <div class="notice">
        <h2>Can't wait to get started?</h2>
        <p><a target="_blank" rel="noopener" href="https://cloud.appwrite.io/">Create your first project now</a> and start building on Appwrite Cloud.</p>
    </div>

    <h2 class="margin-bottom">Overview</h2>

    <p>Appwrite is a secure, open-source backend that abstracts the complexity of common, complex, and repetitive tasks required for building a modern app.</p>

    <p>Appwrite provides you with a set of secure APIs, tools, and a management console UI to help you build your apps quickly without compromising security. Use Appwrite to add user authentication and management, data and file storage, run server-side code, image manipulation, localization, and more into your apps.</p>

    <p>Appwrite adapts to your unique habits and needs. You can integrate Appwrite directly with your client app or use it alongside your existing backend server, using the language and technologies you're most comfortable with.</p>

    <h2 class="margin-bottom">Quickstart Tutorials</h2>

    <div class="row responsive">
        <?php foreach ($clients as $i => $client): ?>
        <div class="col span-6 sdk margin-bottom">

            <a href="<?php echo $this->escape($client['link']); ?>" class="box padding-small clear">

                <img src="<?php echo $client['logo']; ?>" alt="Logo" class="avatar pull-start margin-end" />

                <div class="margin-bottom-tiny text-one-liner"><?php echo $client['title']; ?></div>

                <p class="note text-size-small margin-bottom-no text-one-liner"><?php echo $client['description']; ?></p>
            </a>

        </div>
        <?php if(($i+1) % 2 == 0): ?>
    </div>
    <div class="row responsive">
        <?php endif; ?>

        <?php endforeach; ?>
    </div>

    <div class="margin-bottom-large">
        <h2 class="margin-bottom">Explore Appwrite</h2>
        <p>Appwrite provides all the core features of a modern backend. Explore Appwrite's features for <a href="/docs/authentication">authentication</a>, <a href="/docs/databases">databases</a>, <a href="/docs/storage">file storage</a>, and executing server-side code with <a href="/docs/functions">functions</a>.</p>
        <p>Appwrite is technology-agnostic. You can integrate Appwrite with any of the <a href="/docs/sdks">SDKs</a>, or directly with the <a href="/docs/rest">REST</a> or <a href="/docs/graphql">GraphQL</a> API.</p>
        <p>You can also respond to events in real time with Appwrite's <a href="/docs/realtime">Realtime API</a> or through <a href="/docs/webhooks">webhooks</a>.</p>
    </div>

    <div class="margin-bottom-large">
        <h2 class="margin-bottom">Contributing</h2>

        <p>Are you looking to contribute to Appwrite? Our <a href="https://github.com/appwrite/appwrite/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener">contribution guide</a> has you covered. Want an SDK for a language we don't yet support? Check out the <a href="https://github.com/appwrite/sdk-generator" target="_blank" rel="noopener">SDK generator</a> project. Also, have a look at our <a href="https://github.com/appwrite" target="_blank" rel="noopener">GitHub organization</a> for all of our other projects.</p>
    </div>

    <div class="margin-bottom-large">
        <h2 class="margin-bottom">Learn More</h2>
        <p>Follow our <a href="https://dev.to/appwrite" target="_blank" rel="noopener">blog</a> and subscribe to our newsletter to learn more about Appwrite and stay up-to-date with Appwrite's latest news and announcements. You can also join our <a href="https://appwrite.io/discord" target="_blank" rel="noopener">Discord server</a>, where you can chat with fellow developers and get support from our team and community members.</p>
    </div>
</div>
