<% content_for "deployments" do %>
<div class="header">
  <h1>Your Deployments</h1>
  <a href="/deployments/new" class="button">New Deployment</a>
</div>

<div id="deployments-list">
  <% deployments.each do |deployment| %>
    <div class="deployment-card">
      <div class="deployment-header">
        <div class="deployment-name"><%= deployment.metadata.name %></div>
        <div class="deployment-status status-<%= deployment.status.phase.downcase %>">
          <%= deployment.status.phase %>
        </div>
      </div>
      <div class="deployment-details">
        <div class="detail-group">
          <h4>Source</h4>
          <div><%= deployment.spec.source.type %>: <%= deployment.spec.source.url %></div>
        </div>
        <div class="detail-group">
          <h4>Regions</h4>
          <div><%= deployment.spec.regions.join(", ") %></div>
        </div>
        <div class="detail-group">
          <h4>Resources</h4>
          <div>CPU: <%= deployment.spec.resources.cpu %>, Memory: <%= deployment.spec.resources.memory %></div>
        </div>
      </div>
      <form action="/deployments/<%= deployment.metadata.name %>/delete" method="POST" class="inline-form">
        <button type="submit" class="delete-button" onclick="return confirm('Are you sure you want to delete this deployment?')">
          Delete
        </button>
      </form>
    </div>
  <% end %>

  <% if deployments.empty? %>
    <div class="empty-state">
      <h2>No deployments yet</h2>
      <p>Create your first deployment to get started!</p>
      <a href="/deployments/new" class="button">New Deployment</a>
    </div>
  <% end %>
</div>
<% end %>
