1// Copyright 2020 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5use crate::factory_reset::facade::FactoryResetFacade;
6use crate::factory_reset::types::FactoryResetMethod;
7use crate::server::Facade;
8use anyhow::Error;
9use async_trait::async_trait;
10use serde_json::{to_value, Value};
1112#[async_trait(?Send)]
13impl Facade for FactoryResetFacade {
14async fn handle_request(&self, method: String, _args: Value) -> Result<Value, Error> {
15match method.parse()? {
16 FactoryResetMethod::FactoryReset => {
17let result = self.factory_reset().await?;
18Ok(to_value(result)?)
19 }
20 }
21 }
22}