# (c) cavaliba.com



# --------------------------------------------
# permissions
# --------------------------------------------

- classname: _permission
  keyname: p_sirene_access
  is_builtin: True
  description: "Built-in SIRENE app access"
  displayname: p_sirene_access

- classname: _permission
  keyname: p_sirene_access_restricted
  is_builtin: True
  description: "Built-in SIRENE  access to all restricted messages"
  displayname: p_sirene_access_restricted

- classname: _permission
  keyname: p_sirene_detail
  is_builtin: True
  description: "Built-in SIRENE access details"
  displayname: p_sirene_detail

- classname: _permission
  keyname: p_sirene_history
  is_builtin: True
  description: "Built-in SIRENE access history"
  displayname: p_sirene_history

- classname: _permission
  keyname: p_sirene_new
  is_builtin: True
  description: "Built-in SIRENE create a new notification"
  displayname: p_sirene_new

- classname: _permission
  keyname: p_sirene_update
  is_builtin: True
  description: "Built-in SIRENE update a notification"
  displayname: p_sirene_update

- classname: _permission
  keyname: p_sirene_archive
  is_builtin: True
  description: "Built-in SIRENE archive a notification"
  displayname: p_sirene_archive


- classname: _permission
  keyname: p_sirene_flushall
  is_builtin: True
  description: "Built-in SIRENE archive all active notifications"
  displayname: p_sirene_flushall


- classname: _permission
  keyname: p_sirene_sms_send
  is_builtin: True
  description: "Built-in SIRENE SMS Send"
  displayname: p_sirene_sms_send

- classname: _permission
  keyname: p_sirene_sms_journal
  is_builtin: True
  description: "Built-in SIRENE SMS Journal"
  displayname: p_sirene_sms_journal

- classname: _permission
  keyname: p_sirene_sms_stat
  is_builtin: True
  description: "Built-in SIRENE SMS Stat"
  displayname: p_sirene_sms_stat

# -- public


- classname: _permission
  keyname: p_data_sirene_public_admin
  is_builtin: True
  description: "Built-in data_sirene_public admin permission"
  displayname: p_data_sirene_public_admin

- classname: _permission
  keyname: p_data_sirene_public_create
  is_builtin: True
  description: "Built-in data_sirene_public create permission"
  displayname: p_data_sirene_public_create

- classname: _permission
  keyname: p_data_sirene_public_read
  is_builtin: True
  description: "Built-in data_sirene_public read permission"
  displayname: p_data_sirene_public_read

- classname: _permission
  keyname: p_data_sirene_public_update
  is_builtin: True
  description: "Built-in data_sirene_public update permission"
  displayname: p_data_sirene_public_update
      
- classname: _permission
  keyname: p_data_sirene_public_delete
  is_builtin: True
  description: "Built-in data_sirene_public delete permission"
  displayname: p_data_sirene_public_delete

- classname: _permission
  keyname: p_data_sirene_public_import
  is_builtin: True
  description: "Built-in data_sirene_public import permission"
  displayname: p_data_sirene_public_import

- classname: _permission
  keyname: p_data_sirene_public_export
  is_builtin: True
  description: "Built-in data_sirene_public export permission"
  displayname: p_data_sirene_public_export


# -- template


- classname: _permission
  keyname: p_data_sirene_template_admin
  is_builtin: True
  description: "Built-in data_sirene_template admin permission"
  displayname: p_data_sirene_template_admin

- classname: _permission
  keyname: p_data_sirene_template_create
  is_builtin: True
  description: "Built-in data_sirene_template create permission"
  displayname: p_data_sirene_template_create

- classname: _permission
  keyname: p_data_sirene_template_read
  is_builtin: True
  description: "Built-in data_sirene_template read permission"
  displayname: p_data_sirene_template_read

- classname: _permission
  keyname: p_data_sirene_template_update
  is_builtin: True
  description: "Built-in data_sirene_template update permission"
  displayname: p_data_sirene_template_update
      
- classname: _permission
  keyname: p_data_sirene_template_delete
  is_builtin: True
  description: "Built-in data_sirene_template delete permission"
  displayname: p_data_sirene_template_delete

- classname: _permission
  keyname: p_data_sirene_template_import
  is_builtin: True
  description: "Built-in data_sirene_template import permission"
  displayname: p_data_sirene_template_import

- classname: _permission
  keyname: p_data_sirene_template_export
  is_builtin: True
  description: "Built-in data_sirene_template export permission"
  displayname: p_data_sirene_template_export


# -- message 



- classname: _permission
  keyname: p_data_sirene_message_admin
  is_builtin: True
  description: "Built-in data_sirene_message admin permission"
  displayname: p_data_sirene_message_admin

- classname: _permission
  keyname: p_data_sirene_message_create
  is_builtin: True
  description: "Built-in data_sirene_message create permission"
  displayname: p_data_sirene_message_create

- classname: _permission
  keyname: p_data_sirene_message_read
  is_builtin: True
  description: "Built-in data_sirene_message read permission"
  displayname: p_data_sirene_message_read

- classname: _permission
  keyname: p_data_sirene_message_update
  is_builtin: True
  description: "Built-in data_sirene_message update permission"
  displayname: p_data_sirene_message_update
      
- classname: _permission
  keyname: p_data_sirene_message_delete
  is_builtin: True
  description: "Built-in data_sirene_message delete permission"
  displayname: p_data_sirene_message_delete

- classname: _permission
  keyname: p_data_sirene_message_import
  is_builtin: True
  description: "Built-in data_sirene_message import permission"
  displayname: p_data_sirene_message_import

- classname: _permission
  keyname: p_data_sirene_message_export
  is_builtin: True
  description: "Built-in data_sirene_message export permission"
  displayname: p_data_sirene_message_export






# --------------------------------------------
# roles
# --------------------------------------------

- classname: _role
  keyname: role_sirene_sms
  is_builtin: True
  displayname: Built-in Sirene direct SMS 
  permissions: 
    - p_sirene_access
    - p_sirene_sms_send
    


- classname: _role
  keyname: role_sirene_admin
  is_builtin: True
  displayname: Built-in Sirene admin Role
  permissions: 
    - p_sirene_access
    - p_sirene_access_restricted
    - p_sirene_detail
    - p_sirene_history
    - p_sirene_new
    - p_sirene_update
    - p_sirene_archive
    - p_sirene_flushall
    - p_data_sirene_public_admin
    - p_data_sirene_template_admin
    - p_sirene_sms_send
    - p_sirene_sms_journal
    - p_sirene_sms_stat
    - p_home_access
    - p_iam_access
    - p_user_read
    - p_group_read
    - p_data_access


- classname: _role
  keyname: role_sirene_operator
  is_builtin: True
  displayname: Built-in Sirene Operator Role
  permissions: 
    - p_sirene_access
    - p_sirene_access_restricted
    - p_sirene_detail
    - p_sirene_history
    - p_sirene_new
    - p_sirene_update
    - p_sirene_archive
    - p_sirene_flushall
    - p_data_sirene_public_read
    - p_data_sirene_template_read
    - p_sirene_sms_send
    - p_sirene_sms_journal
    - p_sirene_sms_stat
    - p_home_access
    - p_iam_access
    - p_user_read
    - p_group_read
    - p_data_access
    - p_data_read
    - p_data_app_read
    - p_data_site_read
    - p_data_sitegroup_read



# ---------------------------------------- 
# Sirene - enumerate
# ---------------------------------------- 


- classname: _enumerate
  keyname: sirene_category
  is_enabled: True
  displayname: "Sirene Category"
  description: "Sirene Message Category"
  content: |
    - value: "Incident"
    - value: "Maintenance"
    - value: "Information"
    - value: "Security"
    - value: "Test"
    - value: "Crisis"
    - value: "Other"
    - value: "N/A"


- classname: _enumerate
  keyname: sirene_severity
  is_enabled: True
  displayname: "Sirene Severity"
  description: "Sirene Message Severity"
  content: |
    - value: "OK"
      widget: "green_circle"
    - value: "Information"
      widget: "blue_circle"
    - value: "Minor"
      widget: "yellow_circle"
    - value: "Major"
      widget: "red_circle"
    - value: "Critical"
      widget: "black_circle"
    - value: "Other"
      widget: "brown_circle"
    - value: "N/A"
      widget: "white_circle"

# ---------------------------------------- 
# Sirene Public
# ---------------------------------------- 

- classname: _schema
  keyname: sirene_public
  handle_method: md5
  displayname: Public Pages
  is_enabled: yes
  icon: fa-globe
  order: 310
  page: Sirene
  p_admin: p_data_sirene_public_admin
  p_create: p_data_sirene_public_create
  p_read: p_data_sirene_public_read
  p_update: p_data_sirene_public_update
  p_delete: p_data_sirene_public_delete
  p_import: p_data_sirene_public_import
  p_export: p_data_sirene_public_export

  description:
    displayname: Description
    order: 100
    dataformat: string
  is_default:
    displayname: Default
    order: 110
    dataformat: boolean
  severity:
    displayname: Severity
    order: 120
    dataformat: enumerate
    dataformat_ext: sirene_severity
  bgcolor:
    displayname: Background Color
    order: 130
    dataformat: string
  fgcolor:
    displayname: Text Color
    order: 140
    dataformat: string
  content:
    displayname: Content
    order: 200
    dataformat: text
    dataformat_ext: html


# ---------------------------------------- 
# Sirene Message
# ---------------------------------------- 

- classname: _schema
  keyname: sirene_message
  handle_method: uuid
  displayname: Messages
  is_enabled: yes
  icon: fa-file
  order: 999
  page: Internal
  p_admin: p_data_sirene_message_admin
  p_create: p_data_sirene_message_create
  p_read: p_data_sirene_message_read
  p_update: p_data_sirene_message_update
  p_delete: p_data_sirene_message_delete
  p_import: p_data_sirene_message_import
  p_export: p_data_sirene_message_export


  category:
    displayname: Category
    page: Information
    order: 110
    dataformat: enumerate
    dataformat_ext: sirene_category

  severity:
    displayname: Severity
    page: Information
    order: 120
    dataformat: enumerate
    dataformat_ext: sirene_severity

  public_page:
    displayname: Public Page
    page: Channels
    order: 130
    dataformat: schema
    dataformat_ext: sirene_public

  is_restricted:
    displayname: Restricted
    page: Channels
    order: 140
    dataformat: boolean

  has_email:
    displayname: Email
    page: Channels
    order: 150
    dataformat: boolean
    default: True

  has_sms:
    displayname: SMS
    page: Channels
    order: 160
    dataformat: boolean
    default: False


  notify_user:
    displayname: Notify Users
    page: Notify to
    order: 210
    dataformat: user
    cardinal_max: 0

  notify_group:
    displayname: Notify Groups
    page: Notify to
    order: 220
    dataformat: group
    cardinal_max: 0

  notify_app:
    displayname: Notify App
    page: Notify to
    order: 230
    dataformat: schema
    dataformat_ext: app
    cardinal_max: 0

  notify_site:
    displayname: Notify site
    page: Notify to
    order: 240
    dataformat: schema
    dataformat_ext: site
    cardinal_max: 0

  notified_username:
    displayname: All notified users
    page: Notify to
    order: 290
    dataformat: string
    cardinal_max: 0


#  Lifecycle

  created_at:
    displayname: Created
    page: Lifecycle
    order: 300
    dataformat: datetime
    
  created_by:
    displayname: Created by
    page: Lifecycle
    order: 310
    dataformat: user

  updated_at:
    displayname: Updated
    page: Lifecycle
    order: 320
    dataformat: datetime
    
  updated_by:
    displayname: Updated by
    page: Lifecycle
    order: 330
    dataformat: user


  removed_at:
    displayname: Removed
    page: Lifecycle
    order: 340
    dataformat: datetime
    
  removed_by:
    displayname: Removed by
    page: Lifecycle
    order: 350
    dataformat: user

  email_count:
    displayname: Emails
    page: Lifecycle
    order: 360
    dataformat: int

  sms_count:
    displayname: SMS
    page: Lifecycle
    order: 362
    dataformat: int


# -- Content

  content:
    displayname: Content
    page: Content
    order: 400
    dataformat: text
    dataformat_ext: html

  update:
    displayname: Update(s)
    page: Content
    order: 410
    dataformat: text
    dataformat_ext: json


# ---------------------------------------- 
# Sirene Template
# ---------------------------------------- 

- classname: _schema
  keyname: sirene_template
  handle_method: md5
  displayname: Sirene Templates
  is_enabled: yes
  icon: fa-check-square
  order: 300
  page: Sirene
  p_admin: p_data_sirene_template_admin
  p_create: p_data_sirene_template_create
  p_read: p_data_sirene_template_read
  p_update: p_data_sirene_template_update
  p_delete: p_data_sirene_template_delete
  p_import: p_data_sirene_template_import
  p_export: p_data_sirene_template_export

  description:
    _action: delete

  hint:
    displayname: Hint
    page: Information
    order: 100
    dataformat: string

  category:
    displayname: Category
    page: Information
    order: 110
    dataformat: enumerate
    dataformat_ext: sirene_category

  severity:
    displayname: Severity
    page: Information
    order: 120
    dataformat: enumerate
    dataformat_ext: sirene_severity

  public_page:
    displayname: Public Page
    page: Channels
    order: 130
    dataformat: schema
    dataformat_ext: sirene_public

  is_restricted:
    displayname: Restricted
    page: Channels
    order: 140
    dataformat: boolean

  has_email:
    displayname: Email
    page: Channels
    order: 150
    dataformat: boolean
    default: True

  has_sms:
    displayname: SMS
    page: Channels
    order: 160
    dataformat: boolean
    default: False

  notify_user:
    displayname: Notify Users
    page: Notify to
    order: 310
    dataformat: user
    cardinal_max: 0

  notify_group:
    displayname: Notify Groups
    page: Notify to
    order: 320
    dataformat: group
    cardinal_max: 0

  notify_app:
    displayname: Notify App
    page: Notify to
    order: 330
    dataformat: schema
    dataformat_ext: app
    cardinal_max: 0

  notify_site:
    displayname: Notify site
    page: Notify to
    order: 340
    dataformat: schema
    dataformat_ext: site
    cardinal_max: 0

  content:
    displayname: Content
    page: Content
    order: 400
    dataformat: text
    dataformat_ext: html


# ---------------------------------------- 
# dataview
# ---------------------------------------- 


# -- public

- classname: _dataview
  keyname: sirene_public_default
  target_class: sirene_public
  displayname: Default
  is_enabled: true
  description: Default DataView for Sirene Public Pages
  content: |
    columns:
       - keyname
       - Severity:
            from: severity
       - displayname
       - Description:
            from: description
       - Default:
            from: is_default


# -- template 

- classname: _dataview
  keyname: sirene_template_default
  target_class: sirene_template
  displayname: Default
  is_enabled: true
  description: Default DataView for Sirene Templates
  content: |
    columns:
       - keyname
       - displayname
       - Category:
            from: category
       - Severity:
            from: severity
       - Hint:
            from: hint


# -- message

- classname: _dataview
  keyname: sirene_message_default
  target_class: sirene_message
  displayname: Default
  is_enabled: true
  description: Default DataView for Sirene Messages
  content: |
    columns:
       - keyname
       - displayname
       - Active:
            from: is_visible
       - Category:
            from: category
       - Severity:
            from: severity
       - Description:
            from: description
