//
//  PQEditSubtitleModel.swift
//  PQSpeed
//
//  Created by ak on 2020/12/10.
//  Copyright © 2020 BytesFlow. All rights reserved.
//
// 字幕信息以每一段为单位，都会有一个这样的信息
import ObjectMapper
import RealmSwift
open class PQEditSubTitleModel: PQEditBaseModel {
    // 开始时间
    public var timelineIn: Float64 = 0
    // 结束时间
    public var timelineOut: Float64 = 0
    // 显示每一句字幕
    public var text: String = ""
    required public init() {
        super.init()
    }

    required convenience public init?(map _: Map) {
        self.init()
    }

    public  override func mapping(map: Map) {
        timelineIn <- map["timelineIn"]
        timelineOut <- map["timelineOut"]
        text <- map["text"]
    }

    public init(jsonDict: [String: Any]) {
        super.init()
        if jsonDict.keys.contains("beginTime") {
            timelineIn = Float64("\(jsonDict["beginTime"] ?? "0")") ?? 0
        }
        if jsonDict.keys.contains("endTime") {
            timelineOut = Float64("\(jsonDict["endTime"] ?? "0")") ?? 0
        }
        if jsonDict.keys.contains("text") {
            text = "\(jsonDict["text"] ?? "")"
        }
    }
}
