 <%= f.fields_for :value do |ff| %>
  <%= ff.hidden_field :service, value: 'aws_s3' %>
  <%= ff.fields_for :configs, configs do |fff| %>
    <div class="grid md:grid-cols-2 gap-4">
      <div class="form-control">
        <%= fff.label :access_key_id, 'Access key ID', class: 'label' %>
        <%= fff.text_field :access_key_id, value: configs['access_key_id'], required: true, class: 'base-input' %>
      </div>
      <div class="form-control">
        <%= fff.label :secret_access_key, class: 'label' %>
        <%= fff.password_field :secret_access_key, required: true, class: 'base-input', placeholder: configs['secret_access_key'].present? ? '*************' : '' %>
      </div>
     </div>
    <div class="grid md:grid-cols-2 gap-4">
      <div class="form-control">
        <%= fff.label :region, class: 'label' %>
        <%= fff.text_field :region, value: configs['region'], required: true, class: 'base-input' %>
      </div>
      <div class="form-control">
        <%= fff.label :bucket, class: 'label' %>
        <%= fff.text_field :bucket, value: value['service'] == 'aws_s3' ? configs['bucket'] : '', required: true, class: 'base-input' %>
      </div>
    </div>
    <div class="form-control">
      <%= fff.label :endpoint, "Endpoint (#{t('optional')})", class: 'label' %>
      <%= fff.text_field :endpoint, value: configs['endpoint'], type: :url, class: 'base-input' %>
      <label class="label">
        <span class="label-text-alt"><%= t('for_aws_s3_compatible_apis_like_minio') %></span>
      </label>
    </div>
  <% end %>
<% end %>
