//
//  PQAudioTrackMaterialModel.swift
//  PQSpeed
//
//  Created by ak on 2020/12/5.
//  Copyright © 2020 BytesFlow. All rights reserved.
//

import Foundation
import ObjectMapper
import RealmSwift
import BFCommonKit

public class PQEditAudioTrackMaterialModel: PQEditBaseModel {
    /**
     @objc dynamic var id: Int64 = 0
     @objc dynamic var materialUrl: String = ""
     @objc dynamic var type: String = ""
     @objc dynamic var duration: Float64 = 0
     @objc dynamic var timelineIn: Float64 = 0
     @objc dynamic var timelineOut: Float64 = 0
     @objc dynamic var model_in: Float64 = 0
     @objc dynamic var out: Float64 = 0
     @objc dynamic var volumeGain: Float64 = 0
     @objc dynamic var materialDurationFit: PQEditmaterialDurationFitModel?
     @objc dynamic var locationPath: String = "" {
         didSet {
             BFLog(message: "音频的：locationPath\(locationPath)")
         }
     }
     **/
    @objc dynamic public var id: Int64 = 0
    @objc dynamic public var type: String = ""
    // 音频类型（bgm：背景音乐，produce：合成语音，speech：录音,local : 本地文件）
    @objc dynamic public var voiceType: String = ""
    @objc dynamic public var duration: Float64 = 0
    @objc dynamic public var timelineIn: Float64 = 0
    @objc dynamic public var timelineOut: Float64 = 0
    @objc dynamic public var model_in: Float64 = 0
    @objc dynamic public var out: Float64 = 0
    // 音量增益，保留一位小数，取值范围 0.0 - 10.0，大于1，表示音量增强。小于1，表示音量减小。0.0 表示静音
    @objc dynamic public var volumeGain: Float64 = 0
    @objc dynamic public var materialDurationFit: PQEditmaterialDurationFitModel?
    @objc dynamic public var produceVoiceConfig: PQEditProduceVoiceConfigModel?
    @objc dynamic public var bgmInfo: PQEditBgmInfoModel?
    @objc dynamic public var materialUrl: String = ""
    public var status: inputStatus = .normal
    // add by ak 业务逻辑添加的属性 声音文件的本地址
    // 音频文件本地地址 URI
    @objc dynamic public var locationPath: String = "" {
        didSet {
            BFLog(message: "音频的：locationPath\(locationPath)")
        }
    }

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

    override public func mapping(map: Map) {
        id <- map["id"]
        type <- map["type"]
        voiceType <- map["voiceType"]
        duration <- (map["duration"], timeTransform)
        timelineIn <- (map["timelineIn"], timeTransform)
        timelineOut <- (map["timelineOut"], timeTransform)
        model_in <- (map["in"], timeTransform)
        out <- (map["out"], timeTransform)

        volumeGain <- (map["volumeGain"], volumeGainTransform)
        materialDurationFit <- map["materialDurationFit"]
        produceVoiceConfig <- map["produceVoiceConfig"]
        bgmInfo <- map["bgmInfo"]

        locationPath <- map["locationPath"]
        materialUrl <- map["materialUrl"]
    }
}
