<?php
/**
 * AIデータセンター投資ナビ - 業者一覧・比較ページ
 */

require_once dirname(__DIR__) . '/common/init.php';

$page_title       = 'AIデータセンター投資業者比較【2026年】GPUサーバー・100%即時償却 主要10社';
$page_description = 'AIデータセンター投資・GPUサーバー販売の主要10社を中立比較。ゼロフィールド・KLab・アースコム・税務キーパー・ディライト・ミカタ・ライフサポート・S-Finance・即時償却プロ・GMO等。最低投資額・税制対応・信頼度を一覧化。';
$canonical_url    = SITE_URL . '/companies/';

$companies = require ROOT_DIR . '/data/companies.php';

// type フィルター
$type_filter = $_GET['type'] ?? '';
if ($type_filter) {
    $companies = array_filter($companies, fn($c) => $c['category'] === $type_filter);
}

// 信頼度降順
usort($companies, fn($a, $b) => $b['reliability'] <=> $a['reliability']);

$type_names = [
    'gpu-server' => 'GPUサーバー販社',
    'gpu-cloud'  => 'GPUクラウド',
    'datacenter' => 'AIデータセンター運用',
    'reit'       => 'REIT・株式',
    'fund'       => 'AIインフラファンド',
];

// JSON-LD
$_ld = [];
$_ld[] = json_encode([
    '@context' => 'https://schema.org',
    '@type'    => 'BreadcrumbList',
    'itemListElement' => [
        ['@type' => 'ListItem', 'position' => 1, 'name' => 'ホーム', 'item' => SITE_URL . '/'],
        ['@type' => 'ListItem', 'position' => 2, 'name' => '業者比較', 'item' => $canonical_url],
    ],
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$_ld[] = json_encode([
    '@context' => 'https://schema.org',
    '@type'    => 'ItemList',
    'name'     => 'AIデータセンター投資業者一覧',
    'numberOfItems' => count($companies),
    'itemListElement' => array_map(fn($i, $c) => [
        '@type'    => 'ListItem',
        'position' => $i + 1,
        'item'     => [
            '@type' => 'Organization',
            'name'  => $c['name'],
            'url'   => SITE_URL . '/companies/' . $c['slug'] . '/',
        ],
    ], array_keys($companies), array_values($companies)),
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$json_ld = implode("\n", array_map(fn($ld) => '<script type="application/ld+json">' . $ld . '</script>', $_ld));

require_once ROOT_DIR . '/includes/header.php';
?>

<div class="container">
  <nav class="breadcrumb">
    <a href="<?= SITE_URL ?>/">ホーム</a><span>/</span>
    <span>業者比較</span>
  </nav>

  <div class="page-header">
    <h1>AIデータセンター投資業者比較【2026年】</h1>
    <p class="page-desc">GPUサーバー販社・GPUクラウド・AIデータセンター運用会社を中立比較。当サイトは特定業者の代理店ではないため、利害関係のない情報をお届けします。</p>
  </div>

  <div class="category-tabs">
    <a href="<?= SITE_URL ?>/companies/" class="category-tab <?= !$type_filter ? 'is-active' : '' ?>">すべて（<?= count(require ROOT_DIR . '/data/companies.php') ?>社）</a>
    <?php foreach ($type_names as $key => $label): ?>
    <a href="<?= SITE_URL ?>/companies/?type=<?= h($key) ?>" class="category-tab <?= $type_filter === $key ? 'is-active' : '' ?>"><?= h($label) ?></a>
    <?php endforeach; ?>
  </div>

  <div class="cost-table-wrap">
    <table class="cost-table cost-table-wide">
      <thead>
        <tr>
          <th>順位</th>
          <th>業者名</th>
          <th>区分</th>
          <th>カテゴリ</th>
          <th>最低投資額</th>
          <th>税制対応</th>
          <th>代理店</th>
          <th>信頼度</th>
          <th>詳細</th>
        </tr>
      </thead>
      <tbody>
        <?php $rank = 1; foreach ($companies as $co): ?>
        <tr>
          <td><strong><?= $rank++ ?>位</strong></td>
          <td><?= h($co['name']) ?></td>
          <td><?= h($co['group']) ?></td>
          <td><?= h($type_names[$co['category']] ?? $co['category']) ?></td>
          <td><?= $co['min_amount'] ? '¥' . number_format($co['min_amount']) . '〜' : '—' ?></td>
          <td><?= h($co['tax_scheme']) ?></td>
          <td>
            <?php if ($co['agency'] === true): ?>
              <span class="badge badge-success badge-sm">あり</span>
            <?php elseif ($co['agency'] === false): ?>
              <span class="badge badge-outline badge-sm">なし</span>
            <?php else: ?>
              <span class="badge badge-outline badge-sm">要問合せ</span>
            <?php endif; ?>
          </td>
          <td><?= str_repeat('★', (int)$co['reliability']) ?><?= str_repeat('☆', 5 - (int)$co['reliability']) ?></td>
          <td><a href="<?= SITE_URL ?>/companies/<?= h($co['slug']) ?>/" class="btn btn-sm btn-outline">詳細</a></td>
        </tr>
        <?php endforeach; ?>
      </tbody>
    </table>
  </div>

  <div class="alert alert-info">
    <h3>業者選定時のチェックポイント</h3>
    <ol>
      <li><strong>法人実態</strong>：上場/非上場、資本金、設立年、本店オフィス（レンタルオフィスでないか）</li>
      <li><strong>データセンター提携先の正式開示</strong>：さくら、KDDI、ソフトバンク、GMO等大手と提携しているか</li>
      <li><strong>A類型認定サポート実績</strong>：経営力向上計画認定の事前申請を徹底しているか</li>
      <li><strong>代表者・営業担当の経歴透明性</strong>：過去の登壇歴・寄稿記事が確認できるか</li>
      <li><strong>過去の税務調査否認事例</strong>：契約前に書面で確認</li>
      <li><strong>契約書条項の精査</strong>：免責・解約・出口戦略・買取保証の文言</li>
      <li><strong>顧問税理士・弁護士の有無</strong>：法務体制の確認</li>
    </ol>
  </div>

  <div class="cost-cta">
    <a href="#" class="btn btn-success btn-lg" data-action="open-modal">
      <i data-lucide="message-circle"></i>
      業者選定について無料相談する
    </a>
    <a href="<?= SITE_URL ?>/simulator/" class="btn btn-outline btn-lg">
      <i data-lucide="calculator"></i>
      節税額をシミュレーション
    </a>
  </div>
</div>

<?php require_once ROOT_DIR . '/includes/footer.php'; ?>
