#[derive(PartialEq)]
enum Position{
    Manager,
    Developer,
    Designer,
}
impl Clone for Position{
    fn clone(&self) -> Self
    {
        match self{
            Position::Manager => Position::Manager,
            Position::Developer => Position::Developer,
            Position::Designer => Position::Designer,
        }
    }
}
impl Position{
    fn position_to_string(&self ) -> String
    {
    match self{
            Position::Manager => "manager".to_string(),
            Position::Developer => "developer".to_string(),
            Position::Designer => "developer".to_string(),
        }
    }
}
struct Employee{
    name:String,
    position:Position,
    salary:f64
}

impl Employee{
    fn clone(&self) -> Self{
    Employee {
        name: self.name.clone(),
        position: self.position.clone(),
        salary: self.salary

        }
    }
}
fn employed_on_position(employees:&Vec<Employee>, position:Position) -> Vec<Employee>
    {
        let mut on_picked_position:Vec<Employee> = Vec::new();

        for employee in employees{
            if employee.position == position{
                on_picked_position.push(employee.clone());
            } 
        }
        on_picked_position
    }

fn main()
{
       let employees = vec![
        Employee {
            name: String::from("Alice"),
            position: Position::Manager,
            salary: 1200.0,
        },
        Employee {
            name: String::from("Bob"),
            position: Position::Developer,
            salary: 1200.0,
        },
        Employee {
            name: String::from("Charlie"),
            position: Position::Designer,
            salary: 1200.0,
        }];
        let managers = employed_on_position(&employees, Position::Manager);
        let developers= employed_on_position(&employees, Position::Developer);

        println!("Managers:");
        for employee in managers {
            println!("\t{} - {} - {}", employee.name, employee.position.position_to_string(), employee.salary);
        }
        println!("Developers:");
        for employee in developers{
            println!("\t{} - {} - {}", employee.name, employee.position.position_to_string(), employee.salary);
        }
}
