//
//  PlayerExtension.swift
//  DouShouQiIOS
//
//  Created by Pierre FERREIRA on 04/06/2024.
//

import Foundation
import DouShouQiModel

extension Player {
    
    //var age : Int{get{return 0} set{age = newValue}}
    
    var matches : [Match]{
        return [Match(gameEndScreen: "DouShouQi", opponent: "BadBro", selfScore: 1, opScore: 1)]
    }
    
    /*public convenience init?(withId id : Owner, andName name : String, andAge _age : Int){
        self.init(withName: name, andId: id)
        //self.age = _age
    }
    */
    
    struct Data : Identifiable {
        //var dataId: ObjectIdentifier = ObjectIdentifier()
        var id : Owner
        var name : String
        // Copie de player
    }
    
    var data : Data {
        Data(id: self.id, name: self.name)
    }
    
    func update (from data : Data){
        ///Test de l'id
        if (data.id == .noOne){ // gestion de l'id en fonction de l'utilisation.
            print("Problème de mise a jour des données")
            return
        }
        
        ///Assignations
        //self.id = data.id
        //self.name = data.name
    }
}
