import Foundation

public struct AccessTokenResponse: Codable, Sendable, Equatable {
    public let accessToken: String
    public let tokenType: String

    enum CodingKeys: String, CodingKey {
        case accessToken = "access_token"
        case tokenType = "token_type"
    }
}

public struct UserResponse: Codable, Sendable, Equatable, Identifiable {
    public let id: Int
    public let username: String
    public let isActive: Bool
    public let totpEnabled: Bool
    public let lastLoginAtRaw: String?

    public var lastLoginAt: Date? { DSDate.parse(lastLoginAtRaw) }

    enum CodingKeys: String, CodingKey {
        case id, username
        case isActive = "is_active"
        case totpEnabled = "totp_enabled"
        case lastLoginAtRaw = "last_login_at"
    }
}
