# frozen_string_literal: true module Alula class Device < Alula::RestResource extend Alula::ResourceAttributes extend Alula::RelationshipAttributes extend Alula::ApiOperations::Request extend Alula::ApiOperations::List extend Alula::ApiOperations::Save include Alula::DeviceHelpers::AttributeTranslationsHelper include Alula::DeviceHelpers::ProgramIdHelper # Nested class for features_selected field class FeaturesSelected < Alula::ObjectField field :alarm_transmission, type: :boolean field :alarm_notifications, type: :boolean field :interactive_services, type: :boolean field :home_automation, type: :boolean field :two_way_voice, type: :boolean field :vigilance, type: :boolean field :alarm_verification, type: :boolean field :alula_messenger, type: :boolean field :video_verification, type: :boolean field :sms_notification, type: :boolean field :panel_downloading, type: :boolean # field :onvif_video_hub, type: :boolean # Set by the M2M portal, we don't want it for now end resource_path 'devices' type 'devices' # Relationships relationship :customer, type: 'users', cardinality: 'To-one' # relationship :deactive_customer, type: 'user', cardinality: 'To-one' relationship :dealer, type: 'dealers', cardinality: 'To-one' # relationship :eventlog, type: 'devices-eventlog', cardinality: 'To-many' relationship :receiver_group, type: 'receivers-groups', cardinality: 'To-one' relationship :helix_users, type: 'helix-users', cardinality: 'To-many' relationship :notifications, type: 'devices-notifications', cardinality: 'To-many' relationship :video_verification_cameras, type: 'video-verification-cameras', cardinality: 'To-many' relationship :users, type: 'devices-users', cardinality: 'To-many' # relationship :features_supported, type: 'devices-features-supported', cardinality: 'To-one' # relationship :features_disabled, type: 'devices-features-disabled', cardinality: 'To-one' # Resource Fields # Not all params are used at the moment. See Alula::ResourceAttributes for details # on how params are parsed, field :id, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :mac, type: :string, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :sn, type: :string, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :dealer_id, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :deactive_customer_id, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :customer_id, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :relay_group_enabled, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :interactive_enabled, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :remote_user_logging_feature_enabled, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :push_notification_enabled, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :user_sync_disabled, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :auto_cfg, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :connected_panel, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [:system] field :program_id, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [:system] field :version_id, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [:system] field :meid, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [:system] field :imei, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [:system] field :iccid, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [:system] field :mno, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [:system] field :timezone, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician user] field :online_status, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: [:system] field :online_status_timestamp, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :registered_by, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :date_inserted, type: :date, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :date_registered, type: :date, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :date_activated, type: :date, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :friendly_name, type: :string, sortable: true, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :station_phone_number, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :station_account_number, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician] field :station_aux_number, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :override_account_number, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :signal_suppress_open_close, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :signal_suppress_bypass, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :open_close_suppression, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :convert_sia_to_contact_id, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :downloader_phone_number, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :receiver_group_id, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician] field :network_trouble_timeout, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :physical_address1, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_address2, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_street_number, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_street_name, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_street_direction, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_city, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_state, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_zip, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_site_number, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_suite, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_floor, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :physical_description, type: :string, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician user] field :two_way_voice_enabled, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :sia_two_way_voice_enabled, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: %i[system station dealer technician] field :date_deactivated, type: :date, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :moved_to, type: :string, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :moved_by, type: :string, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :moved_at, type: :string, sortable: true, filterable: true, creatable_by: [], patchable_by: [] field :enforce_features, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [:system] field :bvn, type: :string, sortable: false, filterable: false, creatable_by: [], patchable_by: [], hex_convert_required: true field :features_selected, type: :object, sortable: false, filterable: true, creatable_by: [], patchable_by: %i[system station dealer technician], use: FeaturesSelected field :any_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :ac_failure, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :low_battery, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :server_comm_fail, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :cs_comm_fail, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :onboard_ethernet_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :expansion_slot1_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :expansion_slot2_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :expansion_slot3_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :local_security_app_device_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :alarm_panel_cover_tamper, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :alarm_panel_wall_tamper, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :low_battery_zones, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :supervisory_zones, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :tamper_zones, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :alarm_zones, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :arming_protest, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :siren_trouble_condition, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :pin_pad_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :helipad_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :trouble_zones, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :receiver_jam, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :missing_battery, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :arming_protest_generic, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :keyfob_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :keypads_locked_out, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :keystroke_tamper, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :ce_arming_supervision_trouble_zones, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :master_code_out_of_sync, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :dealer_code_out_of_sync, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :panel_generic_trouble, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :is_camera, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :is_panel, type: :boolean, sortable: false, filterable: true, creatable_by: [], patchable_by: [] field :ip_only_enabled, type: :boolean, sortable: false, filterable: false, creatable_by: [], patchable_by: [] field :ui_settings, type: :object, sortable: false, filterable: false, creatable_by: [], patchable_by: [:system] end end