1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.settingslib.bluetooth.devicesettings.shared.model
18 
19 import com.android.settingslib.bluetooth.devicesettings.DeviceSettingId
20 
21 /** Models a device setting config. */
22 data class DeviceSettingConfigModel(
23     /** Items need to be shown in device details main page. */
24     val mainItems: List<DeviceSettingConfigItemModel>,
25     /** Items need to be shown in device details more settings page. */
26     val moreSettingsItems: List<DeviceSettingConfigItemModel>,
27     /**
28      * Help button which need to be shown on the top right corner of device details more settings
29      * page.
30      */
31     val moreSettingsHelpItem: DeviceSettingConfigItemModel?,
32 )
33 
34 /** Models a device setting item in config. */
35 sealed interface DeviceSettingConfigItemModel {
36     @DeviceSettingId val settingId: Int
37     val highlighted: Boolean
38 
39     /** A built-in item in Settings. */
40     sealed interface BuiltinItem : DeviceSettingConfigItemModel {
41         @DeviceSettingId override val settingId: Int
42         val preferenceKey: String
43 
44         /** A general built-in item in Settings. */
45         data class CommonBuiltinItem(
46             @DeviceSettingId override val settingId: Int,
47             override val highlighted: Boolean,
48             override val preferenceKey: String,
49         ) : BuiltinItem
50 
51         /** A bluetooth profiles in Settings. */
52         data class BluetoothProfilesItem(
53             @DeviceSettingId override val settingId: Int,
54             override val highlighted: Boolean,
55             override val preferenceKey: String,
56             val invisibleProfiles: List<String>,
57         ) : BuiltinItem
58     }
59 
60     /** A remote item provided by other apps. */
61     data class AppProvidedItem(
62         @DeviceSettingId override val settingId: Int,
63         override val highlighted: Boolean,
64     ) : DeviceSettingConfigItemModel
65 }
66