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.intentresolver.contentpreview.payloadtoggle.shared.model
18 
19 /** A dataset of previews for Shareousel. */
20 data class PreviewsModel(
21     /** All available [PreviewModel]s. */
22     val previewModels: List<PreviewModel>,
23     /** Index into [previewModels] that should be initially displayed to the user. */
24     val startIdx: Int,
25     /**
26      * Signals that more data should be loaded to the left of this dataset. A `null` value indicates
27      * that there is no more data to load in that direction.
28      */
29     val loadMoreLeft: (() -> Unit)?,
30     /**
31      * Signals that more data should be loaded to the right of this dataset. A `null` value
32      * indicates that there is no more data to load in that direction.
33      */
34     val loadMoreRight: (() -> Unit)?,
35     /**
36      * Index into [previewModels] where any attempted access less than or equal to it should trigger
37      * a window shift left.
38      */
39     val leftTriggerIndex: Int,
40     /**
41      * Index into [previewModels] where any attempted access greater than or equal to it should
42      * trigger a window shift right.
43      */
44     val rightTriggerIndex: Int,
45 )
46