// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! Implementations of various xsync commands

pub mod cargo_lock;
pub mod cargo_toml;
pub mod rust_toolchain_toml;
pub mod rustfmt_toml;

pub use self::cargo_lock::CargoLock;
pub use self::cargo_toml::CargoToml;
pub use self::rust_toolchain_toml::RustToolchainToml;
pub use self::rustfmt_toml::RustfmtToml;

const GENERATED_HEADER: &str = r#"
# Copyright (C) Microsoft Corporation. All rights reserved.

################################################################################
#                                                                              #
#                    !! DO NOT MANUALLY UPDATE THIS FILE !!                    #
#                                                                              #
################################################################################
#                                                                              #
# This file is automatically @generated by OpenVMM's `xsync` tooling.          #
#                                                                              #
# Please refer to the instructions in `Cargo.xsync.toml` for what steps are    #
# required to regenerate this file.                                            #
#                                                                              #
################################################################################

"#;

mod custom_meta {
    use serde::Deserialize;
    use serde::Serialize;

    #[derive(Debug, Serialize, Deserialize)]
    pub struct CargoOverlayMetadata {
        pub xsync: Xsync,
    }

    #[derive(Debug, Serialize, Deserialize)]
    pub struct Xsync {
        pub inherit: Inherit,
    }

    #[derive(Debug, Serialize, Deserialize)]
    pub struct Inherit {
        pub profile: bool,
        pub patch: bool,
        pub workspace: InheritWorkspace,
        pub rust_toolchain: InheritRustToolchain,
        pub rustfmt: bool,
    }

    #[derive(Debug, Serialize, Deserialize)]
    pub struct InheritWorkspace {
        pub lints: bool,
        pub package: bool,
    }

    #[derive(Debug, Serialize, Deserialize)]
    pub struct InheritRustToolchain {
        pub inherit: bool,
        pub channel_prefix: Option<String>,
    }
}
