view: int_prod_vw_restrictions_release_store {
  derived_table:{ sql:

    SELECT * FROM intelligence.prod.restrictions_release_store
    WHERE {% condition distribution_type %} distribution_type {% endcondition %}

    ;;}

dimension: release_id {
    type: number
    sql: ${TABLE}.release_id ;;
    hidden: yes
  }


  dimension: list_aggregate_restrictions {
    label: "Restrictions by Store (List)"
    group_label: "Restrictions"
    type: string
    sql: ${TABLE}.list_aggregate_restrictions ;;
    html:
    {% assign countries = value | split: ";" %}
    {% unless {{countries.size}} == 0 %}

      <details>
      <summary>Detail ({{countries.size}})</summary>

      <ul>
      {% for country in countries %}
      <li>{{country}}</li>
      {% endfor %}
      </ul>
      </details>

    {% endunless %}
    ;;
  }

  filter: distribution_type {
    label: "Distribution Type"
    group_label: "Restrictions"
    description: "Use this to filter store restrictions based on a distribution type (full track, ringtone, etc)"
    type: string
  }
}
