use crate::VarOrBool;
use super::intent_filter::IntentFilter;
use super::meta_data::MetaData;
use super::resources::{
MipmapOrDrawableResource, Resource, StringResource, StringResourceOrString,
};
use serde::{Deserialize, Serialize};
#[derive(
Debug, Deserialize, Serialize, YaSerialize, YaDeserialize, PartialEq, Eq, Default, Clone,
)]
pub struct Service {
#[yaserde(attribute = true, prefix = "android")]
pub description: Option<Resource<StringResource>>,
#[yaserde(attribute = true, prefix = "android", rename = "directBootAware")]
pub direct_boot_aware: Option<VarOrBool>,
#[yaserde(attribute = true, prefix = "android")]
pub enabled: Option<VarOrBool>,
#[yaserde(attribute = true, prefix = "android")]
pub exported: Option<VarOrBool>,
#[yaserde(attribute = true, prefix = "android", rename = "foregroundServiceType")]
pub foreground_service_type: Option<ForegroundServiceType>,
#[yaserde(attribute = true, prefix = "android")]
pub icon: Option<MipmapOrDrawableResource>,
#[yaserde(attribute = true, prefix = "android", rename = "isolatedProcess")]
pub isolated_process: Option<VarOrBool>,
#[yaserde(attribute = true, prefix = "android")]
pub label: Option<StringResourceOrString>,
#[yaserde(attribute = true, prefix = "android")]
pub name: String,
#[yaserde(attribute = true, prefix = "android")]
pub permission: Option<String>,
#[yaserde(attribute = true, prefix = "android")]
pub process: Option<String>,
#[yaserde(rename = "intent-filter")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub intent_filter: Vec<IntentFilter>,
#[yaserde(rename = "meta-data")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub meta_data: Vec<MetaData>,
#[yaserde(attribute = true, prefix = "tools")]
pub replace: Option<String>,
#[yaserde(attribute = true, prefix = "tools")]
pub remove: Option<String>,
#[yaserde(attribute = true, prefix = "tools")]
pub node: Option<String>,
#[yaserde(attribute = true, prefix = "tools")]
pub ignore: Option<String>,
#[yaserde(attribute = true, prefix = "tools", rename = "targetApi")]
pub target_api: Option<String>,
#[yaserde(attribute = true, prefix = "tools")]
pub selector: Option<String>,
#[yaserde(attribute = true, prefix = "tools")]
pub strict: Option<String>,
}
#[derive(Debug, Deserialize, Serialize, YaSerialize, YaDeserialize, PartialEq, Eq, Clone)]
#[serde(rename_all = "camelCase")]
#[derive(Default)]
pub enum ForegroundServiceType {
#[yaserde(rename = "camera")]
#[default]
Camera,
#[yaserde(rename = "connectedDevice")]
ConnectedDevice,
#[yaserde(rename = "dataSync")]
DataSync,
#[yaserde(rename = "location")]
Location,
#[yaserde(rename = "mediaPlayback")]
MediaPlayback,
#[yaserde(rename = "mediaProjection")]
MediaProjection,
#[yaserde(rename = "microphone")]
Microphone,
#[yaserde(rename = "phoneCall")]
PhoneCall,
}