//
//  EncodableDataSourceAuthorizer.swift
//  RNRookSdk
//
//  Created by Javier Villanueva on 17/12/25.
//
import RookSDK
import Foundation

struct EncodableDataSourceAuthorizer: Encodable {
    
    private let authorizer: RookSDK.DataSourceAuthorizer

    init(_ authorizer: RookSDK.DataSourceAuthorizer) {
        self.authorizer = authorizer
    }

    private enum CodingKeys: String, CodingKey {
        case dataSource
        case authorized
        case authorizationUrl
    }

    func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)

        try container.encode(authorizer.dataSource, forKey: .dataSource)
        try container.encode(authorizer.authorized, forKey: .authorized)
        try container.encode(authorizer.authorizationUrl, forKey: .authorizationUrl)
    }
}
