use crate::baggy::Bag;

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct PlayerId(pub u32);

#[derive(Debug)]
pub struct Player {
    id: PlayerId,
    score: u32,
    bag: Bag,
}

impl Player {
    pub fn new(id: PlayerId, bag: Bag) -> Self {
        Player { id, score: 0, bag }
    }

    pub fn id(&self) -> PlayerId {
        self.id
    }

    pub fn score(&self) -> u32 {
        self.score
    }

    pub fn bag(&self) -> &Bag {
        &self.bag
    }

    pub fn give_points(&mut self, points: u32) {
        self.score = self.score.saturating_add(points);
    }
}
