import Foundation
import ShareAssetClient

public struct VisualizerAssetConfig: Identifiable, Equatable, Hashable {
    /*
        This is client only id for making it
        easier to work with SwiftUI
     */
    public let id: String
    public let displayName: String
    public let shareAssetConfig: ShareAssetConfig
    public let coverImageURL: String?
    public let coverVideoURL: String?

    public init(
        id: String,
        displayName: String,
        shareAssetConfig: ShareAssetConfig,
        coverImageURL: String? = nil,
        coverVideoURL: String? = nil
    ) {
        self.id = id
        self.displayName = displayName
        self.shareAssetConfig = shareAssetConfig
        self.coverImageURL = coverImageURL
        self.coverVideoURL = coverVideoURL
    }

    public var flattenedOverlayStyle: VisualizerOverlayStyle {
        switch shareAssetConfig.stickerStyle {
        case .none:
            return .none

        case .coreInfoStandard:
            return .coreInfoStandard

        case .leadingInfoStandard:
            return .leadingInfoStandard

        case .coreLyricsStandard:
            switch shareAssetConfig.lyricsStyle {
            case .none:
                return .none
            case .lyricsBox:
                return .coreLyricsStandardLyricsBox
            case .lyricsTwoLine:
                return .coreLyricsStandardLyricsTwoLine
            case .lyricsThreeLine:
                return .coreLyricsStandardLyricsThreeLine
            }

        case .framedCoreCenter:
            return .framedCoreCenter

        case .framedCoreTop:
            return .framedCoreTop
        }
    }
}
