434 lines
23 KiB
Swift
434 lines
23 KiB
Swift
import Foundation
|
|
|
|
/// 本地成片上传与整单确认规则;不访问网络、系统相册或真实游客服务。
|
|
final class DroneDeliveryViewModel {
|
|
/// 与机巢、订单及原素材页面共享的数据源。
|
|
let store: DroneDockDemoStore
|
|
/// 固定入口订单,避免列表位置变化后操作其他订单。
|
|
let orderID: String
|
|
/// 用户为下一批明确选择的点位;整单入口初始不自动选点。
|
|
private(set) var selectedPointID: String?
|
|
/// 用户选择的本地示例视频,不读取相册。
|
|
private(set) var selectedVideoIDs: Set<String> = []
|
|
private let context: DroneDockContext
|
|
private let now: () -> Date
|
|
|
|
/// 当前景区、工作人员范围内可访问的入口订单。
|
|
var order: DroneShootingOrder? { isCurrentContext ? store.shootingOrder(id: orderID) : nil }
|
|
/// 配置允许选择的点位,上传不受拍摄距离约束。
|
|
var points: [DroneShootingPoint] { order != nil ? store.shootingPreparations[key]?.points ?? [] : [] }
|
|
/// 当前明确选择的有效点位。
|
|
var selectedPoint: DroneShootingPoint? { points.first { $0.id == selectedPointID } }
|
|
/// 本点尚未成功交付的四个本地视频样例。
|
|
var availableVideos: [DroneDeliveryVideo] {
|
|
guard let point = selectedPoint else { return [] }
|
|
let uploadedSources = Set(works.filter { $0.pointID == point.id }.map(\.sourceVideoID))
|
|
return Self.demoVideos(pointName: point.name).filter { !uploadedSources.contains($0.id) }
|
|
}
|
|
/// 当前人工选择的视频数量。
|
|
var selectedVideoCount: Int { selectedVideoIDs.count }
|
|
/// 上传队列未清除前冻结点位与选择,包括失败结果页。
|
|
var isUploadLocked: Bool { batch != nil }
|
|
/// 点位和至少一个视频均已明确选择才可开始。
|
|
var canStartUpload: Bool { order != nil && batch == nil && selectedPoint != nil && selectedVideoCount > 0 }
|
|
/// 当前共享上传队列及执行令牌。
|
|
var batch: DroneDeliveryUploadBatch? { library?.batch }
|
|
/// 本批成功项数,不代表整单交齐或游客确认。
|
|
var uploadedCount: Int { batch?.items.filter { $0.state.isCompleted }.count ?? 0 }
|
|
/// 本批明确失败项数。
|
|
var failedCount: Int { batch?.items.filter { $0.state.isFailed }.count ?? 0 }
|
|
/// 本批仍需继续的文件数,不包括明确失败项。
|
|
var pendingCount: Int { batch?.items.filter { !$0.state.isCompleted && !$0.state.isFailed }.count ?? 0 }
|
|
/// 本批固定文件总数。
|
|
var totalUploadCount: Int { batch?.items.count ?? 0 }
|
|
/// 完成文件数量占比,不从虚构网络数据推断交付成功。
|
|
var uploadProgress: Double { totalUploadCount == 0 ? 0 : Double(uploadedCount) / Double(totalUploadCount) }
|
|
/// 上传底栏使用的阶段。
|
|
var uploadPhase: DroneDeliveryUploadPhase {
|
|
guard let batch else { return .idle }
|
|
if batch.isPaused && pendingCount > 0 { return .paused }
|
|
if batch.items.contains(where: { if case .uploading = $0.state { return true }; return false }) { return .uploading }
|
|
if failedCount > 0 { return .partialFailure }
|
|
return uploadedCount == totalUploadCount ? .completed : .idle
|
|
}
|
|
/// 所有批次成功交付的本机演示作品。
|
|
var works: [DroneDeliveryWork] { library?.works ?? [] }
|
|
/// 当前整单成功作品按点位汇总。
|
|
var workGroups: [DroneDeliveryWorkGroup] { Self.groups(works) }
|
|
/// 当前版本是否由商家明确勾选交齐,新作品成功追加会清除此勾选。
|
|
var isAllDeliveredReviewed: Bool {
|
|
guard let state = library else { return false }
|
|
return !state.works.isEmpty && state.merchantReviewedRevision == state.revision
|
|
}
|
|
/// 有成功作品、没有未结束上传且明确勾选交齐后才可创建整单确认。
|
|
var canCreateConfirmation: Bool { canReviewCurrentWorks && isAllDeliveredReviewed }
|
|
/// 当前作品版本的有效确认会话,旧清单仍保留在历史中。
|
|
var confirmationSession: DroneDeliveryConfirmationSession? {
|
|
guard let state = library, let id = state.currentSessionID else { return nil }
|
|
return state.sessions.first { $0.id == id && $0.revision == state.revision }
|
|
}
|
|
/// 核对、等待、查看、反馈和确认保持独立,不由刷新自动推进。
|
|
var confirmationPhase: DroneDeliveryConfirmationPhase { confirmationSession?.status ?? .review }
|
|
/// 当前确认会话冻结清单按点位分组。
|
|
var confirmationGroups: [DroneDeliveryWorkGroup] { Self.groups(confirmationSession?.works ?? []) }
|
|
/// 历次已明确模拟确认的记录,追加作品后原快照仍保留。
|
|
var confirmationRecords: [DroneDeliveryConfirmationSession] {
|
|
(library?.sessions ?? []).enumerated().filter { $0.element.status == .confirmed }.sorted {
|
|
let firstDate = $0.element.confirmedAt ?? $0.element.createdAt
|
|
let secondDate = $1.element.confirmedAt ?? $1.element.createdAt
|
|
return firstDate == secondDate ? $0.offset > $1.offset : firstDate > secondDate
|
|
}.map(\.element)
|
|
}
|
|
/// 最近一次已确认的本机演示凭据,不冒充真实收货证明。
|
|
var latestReceipt: DroneDeliveryConfirmationSession? { confirmationRecords.first }
|
|
/// 最近已确认快照的分点清单。
|
|
var receiptGroups: [DroneDeliveryWorkGroup] { Self.groups(latestReceipt?.works ?? []) }
|
|
|
|
private var isCurrentContext: Bool { store.context == context }
|
|
private var key: DroneShootingSessionKey { DroneShootingSessionKey(context: context, orderID: orderID) }
|
|
private var library: DroneDeliveryLibraryState? { order != nil ? store.deliveryLibraries[key] : nil }
|
|
private var canReviewCurrentWorks: Bool { order != nil && !works.isEmpty && pendingCount == 0 && failedCount == 0 }
|
|
|
|
/// 指定入口订单和可选预选点位,时钟可注入以测试确认时间。
|
|
init(store: DroneDockDemoStore, orderID: String, pointID: String? = nil, now: @escaping () -> Date = Date.init) {
|
|
self.store = store
|
|
self.orderID = orderID
|
|
selectedPointID = pointID
|
|
context = store.context
|
|
self.now = now
|
|
refresh()
|
|
}
|
|
|
|
/// 主动读取共享状态;已存在交付摘要首次生成相应作品及确认快照。
|
|
func refresh() {
|
|
guard isCurrentContext, let order else {
|
|
pauseStoredUpload(reason: .leavingPage)
|
|
selectedVideoIDs = []
|
|
return
|
|
}
|
|
store.ensureShootingPreparation(orderID: orderID)
|
|
if store.deliveryLibraries[key] == nil {
|
|
store.deliveryLibraries[key] = initialState(order: order)
|
|
}
|
|
if let batch { selectedPointID = batch.pointID }
|
|
else if !points.contains(where: { $0.id == selectedPointID }) { selectedPointID = nil }
|
|
if batch == nil { selectedVideoIDs.formIntersection(Set(availableVideos.map(\.id))) }
|
|
projectOrderSummary()
|
|
}
|
|
|
|
/// 点位改变清空旧视频勾选,进行中的固定批次不能改点。
|
|
func selectPoint(id: String) {
|
|
guard !isUploadLocked, points.contains(where: { $0.id == id }), selectedPointID != id else { return }
|
|
selectedPointID = id
|
|
selectedVideoIDs = []
|
|
}
|
|
|
|
/// 独立切换本点仍可上传的视频选择。
|
|
func toggleVideo(id: String) {
|
|
guard !isUploadLocked, availableVideos.contains(where: { $0.id == id }) else { return }
|
|
if !selectedVideoIDs.insert(id).inserted { selectedVideoIDs.remove(id) }
|
|
}
|
|
|
|
/// 开始本地演示批次,只冻结已选文件,不表示真实云端已上传。
|
|
@discardableResult
|
|
func startUpload() -> Bool {
|
|
guard canStartUpload, let point = selectedPoint, var state = library else { return false }
|
|
let videos = availableVideos.filter { selectedVideoIDs.contains($0.id) }
|
|
guard !videos.isEmpty else { return false }
|
|
state.batch = DroneDeliveryUploadBatch(id: UUID(), pointID: point.id, pointName: point.name,
|
|
items: videos.map { DroneDeliveryUploadItem(id: UUID().uuidString, video: $0, state: .uploading(progress: 0)) },
|
|
isPaused: false, pauseReason: nil)
|
|
store.deliveryLibraries[key] = state
|
|
return true
|
|
}
|
|
|
|
/// 后台、锁屏或离页停止未完成执行,已成功作品始终保留。
|
|
func pauseUpload(reason: DroneDeliveryPauseReason) {
|
|
guard isCurrentContext else { return }
|
|
pauseStoredUpload(reason: reason)
|
|
}
|
|
|
|
/// 用户手动继续仅处理未完成项,失败项需单独重试。
|
|
@discardableResult
|
|
func continueUpload() -> Bool {
|
|
guard var state = library, let old = state.batch, old.isPaused, pendingCount > 0 else { return false }
|
|
let items = old.items.map { item -> DroneDeliveryUploadItem in
|
|
var item = item
|
|
if item.state == .paused { item.state = .uploading(progress: 0) }
|
|
return item
|
|
}
|
|
state.batch = renewedBatch(old, items: items, isPaused: false, reason: nil)
|
|
store.deliveryLibraries[key] = state
|
|
return true
|
|
}
|
|
|
|
/// 仅重试明确失败的文件;已成功作品不会再次加入或上传。
|
|
@discardableResult
|
|
func retryFailedUploads() -> Bool {
|
|
guard var state = library, let old = state.batch, pendingCount == 0, failedCount > 0 else { return false }
|
|
let items = old.items.map { item -> DroneDeliveryUploadItem in
|
|
var item = item
|
|
if item.state.isFailed { item.state = .uploading(progress: 0) }
|
|
return item
|
|
}
|
|
state.batch = renewedBatch(old, items: items, isPaused: false, reason: nil)
|
|
store.deliveryLibraries[key] = state
|
|
return true
|
|
}
|
|
|
|
/// 明确结束已完成或失败的批次后继续同一点追加;成功作品不受影响。
|
|
func clearUploadBatch() {
|
|
guard var state = library, state.batch != nil, pendingCount == 0 else { return }
|
|
state.batch = nil
|
|
store.deliveryLibraries[key] = state
|
|
selectedVideoIDs = []
|
|
}
|
|
|
|
/// 接收本地上传回执,校验上下文、批次令牌及单项状态后才追加作品。
|
|
func receiveUpload(_ event: DroneDeliveryUploadEvent, itemID: String, batchID: UUID) {
|
|
guard var state = library, var batch = state.batch, batch.id == batchID, !batch.isPaused,
|
|
let index = batch.items.firstIndex(where: { $0.id == itemID }),
|
|
case .uploading(let previous) = batch.items[index].state else { return }
|
|
let item = batch.items[index]
|
|
switch event {
|
|
case .progress(let value):
|
|
guard value.isFinite else { return }
|
|
batch.items[index].state = .uploading(progress: max(previous, min(1, max(0, value))))
|
|
case .failed(let message): batch.items[index].state = .failed(message: message)
|
|
case .succeeded:
|
|
batch.items[index].state = .completed
|
|
if !state.works.contains(where: { $0.id == item.id || ($0.pointID == batch.pointID && $0.sourceVideoID == item.video.id) }) {
|
|
state.works.append(Self.work(item: item, pointID: batch.pointID, pointName: batch.pointName, date: now()))
|
|
state.revision += 1
|
|
state.merchantReviewedRevision = nil
|
|
state.currentSessionID = nil
|
|
}
|
|
}
|
|
state.batch = batch
|
|
store.deliveryLibraries[key] = state
|
|
projectOrderSummary()
|
|
}
|
|
|
|
/// 商家明确核对本版本全部成功作品,不由上传完成自动勾选。
|
|
func setAllDeliveredReviewed(_ checked: Bool) {
|
|
guard var state = library else { return }
|
|
state.merchantReviewedRevision = checked && canReviewCurrentWorks ? state.revision : nil
|
|
store.deliveryLibraries[key] = state
|
|
}
|
|
|
|
/// 为当前整单清单创建不可替换的本机演示确认会话,重复点击复用同一会话。
|
|
@discardableResult
|
|
func createConfirmationSession() -> Bool {
|
|
guard canCreateConfirmation, var state = library, let order else { return false }
|
|
if confirmationSession != nil { return true }
|
|
let session = makeSession(works: state.works, revision: state.revision, order: order)
|
|
state.sessions.append(session)
|
|
state.currentSessionID = session.id
|
|
store.deliveryLibraries[key] = state
|
|
projectOrderSummary()
|
|
return true
|
|
}
|
|
|
|
/// 只刷新共享状态,不推断游客已经查看或已经确认。
|
|
func refreshConfirmation() { refresh() }
|
|
|
|
/// 明确回到商家核对并废弃当前令牌,历史清单与已确认记录仍保留。
|
|
func beginNewReview() {
|
|
guard var state = library else { return }
|
|
state.currentSessionID = nil
|
|
state.merchantReviewedRevision = nil
|
|
store.deliveryLibraries[key] = state
|
|
projectOrderSummary()
|
|
}
|
|
|
|
private func pauseStoredUpload(reason: DroneDeliveryPauseReason) {
|
|
guard var state = store.deliveryLibraries[key], let old = state.batch,
|
|
old.items.contains(where: { !$0.state.isCompleted && !$0.state.isFailed }) else { return }
|
|
let items = old.items.map { item -> DroneDeliveryUploadItem in
|
|
var item = item
|
|
if case .uploading = item.state { item.state = .paused }
|
|
return item
|
|
}
|
|
state.batch = renewedBatch(old, items: items, isPaused: true, reason: reason)
|
|
store.deliveryLibraries[key] = state
|
|
}
|
|
|
|
private func renewedBatch(_ old: DroneDeliveryUploadBatch, items: [DroneDeliveryUploadItem],
|
|
isPaused: Bool, reason: DroneDeliveryPauseReason?) -> DroneDeliveryUploadBatch {
|
|
DroneDeliveryUploadBatch(id: UUID(), pointID: old.pointID, pointName: old.pointName,
|
|
items: items, isPaused: isPaused, pauseReason: reason)
|
|
}
|
|
|
|
private func projectOrderSummary() {
|
|
guard let state = library, let order else { return }
|
|
let confirmation: DroneVisitorConfirmationState
|
|
if state.works.isEmpty { confirmation = .none }
|
|
else if confirmationSession?.status == .confirmed { confirmation = .confirmed }
|
|
else { confirmation = state.sessions.isEmpty ? .none : .awaitingConfirmation }
|
|
store.replaceShootingOrder(order.replacingDeliverySummary(count: state.works.count, confirmation: confirmation))
|
|
}
|
|
|
|
private func initialState(order: DroneShootingOrder) -> DroneDeliveryLibraryState {
|
|
var state = DroneDeliveryLibraryState()
|
|
guard order.deliveredVideoCount > 0 else { return state }
|
|
state.works = seededWorks(count: order.deliveredVideoCount)
|
|
state.revision = 1
|
|
if order.visitorConfirmationState != .none {
|
|
var session = makeSession(works: state.works, revision: state.revision, order: order)
|
|
if order.visitorConfirmationState == .confirmed {
|
|
session.status = .confirmed
|
|
session.visitorAcknowledged = true
|
|
session.confirmedAt = now()
|
|
}
|
|
state.sessions = [session]
|
|
state.currentSessionID = session.id
|
|
state.merchantReviewedRevision = state.revision
|
|
}
|
|
return state
|
|
}
|
|
|
|
private func makeSession(works: [DroneDeliveryWork], revision: Int, order: DroneShootingOrder) -> DroneDeliveryConfirmationSession {
|
|
DroneDeliveryConfirmationSession(id: UUID(), revision: revision, orderID: order.id,
|
|
orderNumber: order.orderNumber, visitorName: order.customerName, operatorName: context.photographerName,
|
|
scenicName: context.scenicName, works: works, createdAt: now(), status: .awaitingConfirmation,
|
|
confirmedAt: nil, feedback: nil, visitorAcknowledged: false)
|
|
}
|
|
|
|
private func seededWorks(count: Int) -> [DroneDeliveryWork] {
|
|
guard count > 0 else { return [] }
|
|
let knownPoints = points
|
|
return (0..<count).map { index in
|
|
let point = knownPoints.isEmpty ? nil : knownPoints[min(index / 2, knownPoints.count - 1)]
|
|
let video = Self.demoVideos(pointName: point?.name ?? "三皇寨")[index % 4]
|
|
let item = DroneDeliveryUploadItem(id: "\(orderID)-existing-work-\(index + 1)",
|
|
video: DroneDeliveryVideo(id: "existing-source-\(index + 1)", title: video.title, fileName: video.fileName,
|
|
previewAssetName: video.previewAssetName, previewURL: video.previewURL,
|
|
durationText: video.durationText, sizeText: video.sizeText), state: .completed)
|
|
return Self.work(item: item, pointID: point?.id ?? "point-sanhuang", pointName: point?.name ?? "三皇寨",
|
|
date: Date(timeIntervalSince1970: 1_792_723_000 + Double(index)))
|
|
}
|
|
}
|
|
|
|
private static func work(item: DroneDeliveryUploadItem, pointID: String, pointName: String, date: Date) -> DroneDeliveryWork {
|
|
DroneDeliveryWork(id: item.id, sourceVideoID: item.video.id, pointID: pointID, pointName: pointName,
|
|
title: item.video.title, fileName: item.video.fileName, previewAssetName: item.video.previewAssetName,
|
|
previewURL: item.video.previewURL, durationText: item.video.durationText, sizeText: item.video.sizeText,
|
|
deliveredAt: date, isSimulation: true)
|
|
}
|
|
|
|
private static func groups(_ works: [DroneDeliveryWork]) -> [DroneDeliveryWorkGroup] {
|
|
var pointIDs: [String] = []
|
|
var grouped: [String: [DroneDeliveryWork]] = [:]
|
|
for work in works {
|
|
if grouped[work.pointID] == nil { pointIDs.append(work.pointID) }
|
|
grouped[work.pointID, default: []].append(work)
|
|
}
|
|
return pointIDs.compactMap { id in
|
|
guard let items = grouped[id], let first = items.first else { return nil }
|
|
return DroneDeliveryWorkGroup(pointID: id, pointName: first.pointName, works: items)
|
|
}
|
|
}
|
|
|
|
private static func demoVideos(pointName: String) -> [DroneDeliveryVideo] {
|
|
let url = Bundle.main.url(forResource: "drone_material_demo", withExtension: "mp4")
|
|
let assets = ["drone_demo_tourists", "drone_demo_mountain", "drone_demo_pagoda", "drone_demo_tourists"]
|
|
return (1...4).map { index in
|
|
let number = String(format: "%02d", index)
|
|
return DroneDeliveryVideo(id: "demo-video-\(index)", title: "成片视频 \(number)",
|
|
fileName: "\(pointName)_成片\(number).mp4", previewAssetName: assets[index - 1],
|
|
previewURL: url, durationText: "00:03", sizeText: "本地演示文件")
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
/// 演示游客主动勾选当前冻结清单,关闭或刷新不会代为勾选。
|
|
func setVisitorAcknowledged(_ checked: Bool) {
|
|
guard var state = library, let session = confirmationSession, session.status == .viewing,
|
|
let index = state.sessions.firstIndex(where: { $0.id == session.id }) else { return }
|
|
state.sessions[index].visitorAcknowledged = checked
|
|
store.deliveryLibraries[key] = state
|
|
}
|
|
|
|
/// 只在 Debug 注入游客演示回执,旧会话或旧作品版本永不修改当前确认结果。
|
|
func receiveConfirmation(_ event: DroneDeliveryConfirmationEvent, sessionID: UUID) {
|
|
guard var state = library, let session = confirmationSession, session.id == sessionID,
|
|
session.status != .confirmed,
|
|
let index = state.sessions.firstIndex(where: { $0.id == sessionID }) else { return }
|
|
switch event {
|
|
case .viewing:
|
|
guard session.status == .awaitingConfirmation || session.status == .feedback else { return }
|
|
state.sessions[index].status = .viewing
|
|
state.sessions[index].visitorAcknowledged = false
|
|
case .confirmed:
|
|
guard session.status == .viewing, session.visitorAcknowledged else { return }
|
|
state.sessions[index].status = .confirmed
|
|
state.sessions[index].confirmedAt = now()
|
|
case .feedback(let kind, let note):
|
|
guard session.status == .viewing else { return }
|
|
let trimmed = String(note.trimmingCharacters(in: .whitespacesAndNewlines).prefix(500))
|
|
guard kind != .other || !trimmed.isEmpty else { return }
|
|
state.sessions[index].status = .feedback
|
|
state.sessions[index].visitorAcknowledged = false
|
|
state.sessions[index].feedback = DroneDeliveryFeedback(kind: kind, note: trimmed, createdAt: now())
|
|
}
|
|
store.deliveryLibraries[key] = state
|
|
projectOrderSummary()
|
|
}
|
|
|
|
/// 仅本地替换交付验收状态,保留拍摄额度、任务、原素材和订单归类。
|
|
func applyScenario(_ scenario: DroneDeliveryScenario) {
|
|
guard let order else { return }
|
|
var state = library ?? initialState(order: order)
|
|
state.batch = nil
|
|
if scenario == .empty { state = DroneDeliveryLibraryState() }
|
|
store.deliveryLibraries[key] = state
|
|
selectedVideoIDs = []
|
|
switch scenario {
|
|
case .empty, .ready: break
|
|
case .uploading, .paused, .partialFailure, .completed:
|
|
if selectedPoint == nil { selectedPointID = points.first?.id }
|
|
let chosen = Array(availableVideos.prefix(2))
|
|
selectedVideoIDs = Set(chosen.map(\.id))
|
|
guard startUpload(), let batch else { projectOrderSummary(); return }
|
|
if scenario == .uploading { break }
|
|
if let first = batch.items.first { receiveUpload(.succeeded, itemID: first.id, batchID: batch.id) }
|
|
if scenario == .paused { pauseUpload(reason: .background) }
|
|
else {
|
|
for item in batch.items.dropFirst() {
|
|
receiveUpload(scenario == .partialFailure ? .failed(message: "演示连接中断") : .succeeded,
|
|
itemID: item.id, batchID: batch.id)
|
|
}
|
|
}
|
|
case .awaitingConfirmation, .viewing, .feedback, .confirmed:
|
|
if state.works.isEmpty {
|
|
state.works = seededWorks(count: 3)
|
|
state.revision += 1
|
|
store.deliveryLibraries[key] = state
|
|
}
|
|
beginNewReview()
|
|
setAllDeliveredReviewed(true)
|
|
guard createConfirmationSession(), let session = confirmationSession else { return }
|
|
if scenario != .awaitingConfirmation { receiveConfirmation(.viewing, sessionID: session.id) }
|
|
if scenario == .feedback { receiveConfirmation(.feedback(kind: .unplayable, note: "演示:有一个视频无法播放"), sessionID: session.id) }
|
|
if scenario == .confirmed {
|
|
setVisitorAcknowledged(true)
|
|
receiveConfirmation(.confirmed, sessionID: session.id)
|
|
}
|
|
}
|
|
projectOrderSummary()
|
|
}
|
|
#endif
|
|
}
|
|
|
|
/// 复制订单交付摘要,拍摄次数、当前任务和原素材状态原样保留。
|
|
extension DroneShootingOrder {
|
|
/// 只更新成功作品数和游客确认标签,不改变订单履约归类。
|
|
func replacingDeliverySummary(count: Int, confirmation: DroneVisitorConfirmationState) -> DroneShootingOrder {
|
|
DroneShootingOrder(id: id, scenicID: scenicID, assignedUserID: assignedUserID, customerName: customerName,
|
|
orderNumber: orderNumber, createdAtText: createdAtText, packageName: packageName,
|
|
totalShootingCount: totalShootingCount, successfulShootingCount: successfulShootingCount,
|
|
activeTask: activeTask, needsRepreparation: needsRepreparation, materialState: materialState,
|
|
deliveredVideoCount: max(0, count), visitorConfirmationState: confirmation)
|
|
}
|
|
}
|