<section class="field">
  {{#if this.category.is_special}}
    {{#if this.category.isUncategorizedCategory}}
      <p class="warning">{{i18n "category.uncategorized_security_warning"}}</p>
    {{else}}
      <p class="warning">{{i18n "category.special_warning"}}</p>
    {{/if}}
  {{/if}}

  {{#unless this.category.is_special}}
    <div class="category-permissions-table">
      <div class="permission-row row-header">
        <span class="group-name">{{i18n "category.permissions.group"}}</span>
        <span class="options">
          <span class="cell">{{i18n "category.permissions.see"}}</span>
          <span class="cell">{{i18n "category.permissions.reply"}}</span>
          <span class="cell">{{i18n "category.permissions.create"}}</span>
        </span>
      </div>
      {{#each this.category.permissions as |p|}}
        <CategoryPermissionRow
          @group_name={{p.group_name}}
          @type={{p.permission_type}}
          @category={{this.category}}
          @everyonePermission={{this.everyonePermission}}
        />
      {{/each}}

      {{#unless this.category.permissions}}
        <div class="permission-row row-empty">
          {{i18n "category.permissions.no_groups_selected"}}
        </div>
      {{/unless}}

      {{#if this.category.availableGroups}}
        <div class="add-group">
          <span class="group-name">
            <ComboBox
              @class="available-groups"
              @content={{this.category.availableGroups}}
              @onChange={{action "onSelectGroup"}}
              @value={{null}}
              @valueProperty={{null}}
              @nameProperty={{null}}
              @options={{hash none="category.security_add_group"}}
            />
          </span>
        </div>
      {{/if}}
    </div>

    {{#if this.everyoneGrantedFull}}
      <p class="warning">{{i18n "category.permissions.everyone_has_access"}}</p>
    {{/if}}
  {{/unless}}
</section>

<section>
  <PluginOutlet
    @name="category-custom-security"
    @outletArgs={{hash category=this.category}}
  />
</section>