<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
  ~
  ~ Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
  ~ Version 2.0 (the "License"); you may not use this file except
  ~ in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->
<DeviceTypeConfiguration name="samples">

	<!--IF SAVE ON PREDEFINED TABLE-->
	<!--<DeviceDetails table-id="SAMPLE_DEVICE_1"/>-->
	<!--ELSE SAVE ON EXISTING TABLE-->
	<DeviceDetails>
		<Properties>
			<Property>attr1</Property>
			<Property>attr2</Property>
		</Properties>
	</DeviceDetails>
	<!--END-->

	<Features>
		<Feature type="operation" hidden="true" code="abc">
			<Name>abc</Name>
			<Description>this is a feature</Description>
			<Operation hidden="true">
				<params>
					<queryParams>
						<Parameter>deviceId</Parameter>
					</queryParams>
					<formParams>
						<Parameter>test</Parameter>
					</formParams>
				</params>
				<metadata>
					<uri>/bulb/{state}</uri>
					<method>POST</method>
					<contentType>application/json</contentType>
				</metadata>
			</Operation>
		</Feature>
	</Features>

	<Claimable enabled="true"/>

	<!--<Sensors table-id="SAMPLE_DEVICE_2">-->
	<!--<Sensor code="CPU_Temperature">-->
	<!--<Name>temperature sensor fitted</Name>-->
	<!--<StreamDefinition>org.wso2.temperature.stream</StreamDefinition>-->
	<!--<Description>this is a sensor</Description>-->
	<!--<SensorStaticProperties>-->
	<!--<Property name="unit">celcius</Property>-->
	<!--<Property name="model_number">atmeggga11234</Property>-->
	<!--</SensorStaticProperties>-->
	<!--</Sensor>-->
	<!--<Sensor code="DHT11_Temperature">-->
	<!--<Name>temperature sensor fitted</Name>-->
	<!--<StreamDefinition>org.wso2.temperature.stream</StreamDefinition>-->
	<!--<Description>this is a sensor</Description>-->
	<!--<SensorStaticProperties>-->
	<!--<Property name="unit">celcius</Property>-->
	<!--</SensorStaticProperties>-->
	<!--<SensorDynamicProperties>-->
	<!--<Property name="model_number"/>-->
	<!--</SensorDynamicProperties>-->
	<!--</Sensor>-->
	<!--</Sensors>-->

	<ProvisioningConfig>
		<SharedWithAllTenants>false</SharedWithAllTenants>
	</ProvisioningConfig>

	<DeviceAuthorizationConfig>
		<authorizationRequired>true</authorizationRequired>
	</DeviceAuthorizationConfig>

	<PushNotificationProvider type="MQTT" isScheduled="false">
		<FileBasedProperties>true</FileBasedProperties>
		<!--if file based properties is set to false then the configuration will be picked from platform configuration-->
		<ConfigProperties>
			<Property Name="mqttAdapterName">sample.mqtt.adapter</Property>
			<Property Name="url">tcp://localhost:1883</Property>
			<Property Name="username">admin</Property>
			<Property Name="password">admin</Property>
			<Property Name="qos">0</Property>
			<Property Name="scopes"/>
			<Property Name="clearSession">true</Property>
		</ConfigProperties>
	</PushNotificationProvider>

	<PullNotificationSubscriberConfig className="io.entgra.device.mgt.core.device.mgt.extensions.pull.notification.PullNotificationSubscriberImpl">
		<ConfigProperties>
			<Property Name="example">admin</Property>
		</ConfigProperties>
	</PullNotificationSubscriberConfig>

	<PolicyMonitoring enabled="true"/>

	<License>
		<Language>en_US</Language>
		<Version>1.0.0</Version>
		<Text>This is license text</Text>
	</License>

	<TaskConfiguration>
		<Enable>true</Enable>
		<Frequency>600000</Frequency>
		<Operations>
			<Operation>
				<Name>DEVICE_INFO</Name>
				<RecurrentTimes>1</RecurrentTimes>
			</Operation>
			<Operation>
				<Name>APPLICATION_LIST</Name>
				<RecurrentTimes>5</RecurrentTimes>
			</Operation>
			<Operation>
				<Name>DEVICE_LOCATION</Name>
				<RecurrentTimes>1</RecurrentTimes>
			</Operation>
		</Operations>
	</TaskConfiguration>

	<DataSource>
		<jndiConfig>
			<name>jdbc/SampleDM_DB</name>
		</jndiConfig>
		<tableConfig>
			<Table name="SAMPLE_DEVICE_1">
				<PrimaryKey>SAMPLE_DEVICE_ID</PrimaryKey>
				<Attributes>
					<Attribute>column1</Attribute>
					<Attribute>column2</Attribute>
				</Attributes>
			</Table>
		</tableConfig>
	</DataSource>

	<InitialOperationConfig>
		<Operations>
			<Operation>DEVICE_INFO</Operation>
			<Operation>APPLICATION_LIST</Operation>
			<Operation>DEVICE_LOCATION</Operation>
		</Operations>
	</InitialOperationConfig>

	<!--This configures the Task service for the device-type. Given below are the property definitions.
        <RequireStatusMonitoring> - This will enable or disable status monitoring for that particular device-type.
        <Frequency> - The time interval (in seconds) in which the task should run for this device-type
        <IdleTimeToMarkInactive> - The time duration (in seconds) in which the device can be moved to inactive status
                                   which means the device will be moved to inactive status if that device does not
                                   contact the server within that time period.
        <IdleTimeToMarkUnreachable> - The time duration (in seconds) in which the device can be moved to unreachable status
                                      which means the device will be moved to unreachable status if that device does not
                                      contact the server within that time period.
    -->
	<DeviceStatusTaskConfig>
		<RequireStatusMonitoring>false</RequireStatusMonitoring>
		<Frequency>300</Frequency>
		<IdleTimeToMarkInactive>600</IdleTimeToMarkInactive>
		<IdleTimeToMarkUnreachable>300</IdleTimeToMarkUnreachable>
	</DeviceStatusTaskConfig>

</DeviceTypeConfiguration>
