import Foundation
import GenAPI

public enum LyricDisplay: String, Codable, CaseIterable, Equatable, Sendable {
    case bottomLeftLine = "bottom_left_line"
    case bottomLeftWord = "bottom_left_word"
    case centeredLine = "centered_line"
    case centeredWord = "centered_word"

    public init(from decoder: Decoder) throws {
        let container = try decoder.singleValueContainer()
        let rawValue = try container.decode(String.self)

        self = LyricDisplay(rawValue: rawValue) ?? .bottomLeftLine
    }
}

extension LyricDisplay {
    init(_ remote: GenAPI.LyricDisplay) {
        self = LyricDisplay(rawValue: remote.rawValue) ?? .bottomLeftLine
    }
}
