//
//  LoginSettings.swift
//  Pachyderm
//
//  Created by Shadowfacts on 9/9/18.
//  Copyright © 2018 Shadowfacts. All rights reserved.
//

import Foundation

public struct LoginSettings: Decodable, Sendable {
    public let accessToken: String
    private let scope: String?
    
    public var scopes: [Scope] {
        guard let scope = scope else { return [] }
        return scope.components(separatedBy: .whitespaces).compactMap(Scope.init)
    }
    
    private enum CodingKeys: String, CodingKey {
        case accessToken = "access_token"
        case scope
    }
}
