{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
~}}

{{#if this.policy.policyType}}
  <Hds::Tabs as |T|>
    <T.Tab data-test-tab-your-policy>
      Your Policy
    </T.Tab>
    <T.Tab Tab data-test-tab-example-policy>
      Example Policy
    </T.Tab>

    <T.Panel>
      <PolicyForm @onSave={{this.onSave}} @model={{this.policy}} @onCancel={{@onCancel}} />
    </T.Panel>
    <T.Panel class="has-top-padding-m">
      <PolicyExample @policyType={{this.policy.policyType}} @container="#search-select-modal" />
    </T.Panel>
  </Hds::Tabs>
{{else}}
  <Select
    @name="policyType"
    @label="Type"
    @options={{this.policyOptions}}
    @isFullwidth={{true}}
    @selectedValue={{this.policy.policyType}}
    @onChange={{this.setPolicyType}}
    @noDefault={{true}}
  />
  <EmptyState @title="No policy type selected" @message="Select a policy type to continue creating." />
{{/if}}