// Code generated by ndpgen. DO NOT EDIT.
//
//! Navidrome shared plugin data types.

use serde::{Deserialize, Serialize};
{{- if .HasHashMap}}
use std::collections::HashMap;
{{- end}}
{{- if .HasByteFields}}{{template "base64_bytes_module" .}}{{- end}}

// Helper functions for skip_serializing_if with numeric types
#[allow(dead_code)]
fn is_zero_i32(value: &i32) -> bool { *value == 0 }
#[allow(dead_code)]
fn is_zero_u32(value: &u32) -> bool { *value == 0 }
#[allow(dead_code)]
fn is_zero_i64(value: &i64) -> bool { *value == 0 }
#[allow(dead_code)]
fn is_zero_u64(value: &u64) -> bool { *value == 0 }
#[allow(dead_code)]
fn is_zero_f32(value: &f32) -> bool { *value == 0.0 }
#[allow(dead_code)]
fn is_zero_f64(value: &f64) -> bool { *value == 0.0 }
{{- range .Structs}}

{{- if .Doc}}
{{rustDocComment .Doc}}
{{- else}}
/// {{.Name}} represents the {{.Name}} data structure.
{{- end}}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct {{.Name}} {
{{- range .Fields}}
{{- if .Doc}}
{{rustDocComment .Doc | indent 4}}
{{- end}}
{{- if .OmitEmpty}}
    #[serde(default, skip_serializing_if = "{{skipSerializingFunc .Type}}")]
{{- else}}
    #[serde(default)]
{{- end}}
{{- if .IsByteSlice}}
    #[serde(with = "base64_bytes")]
{{- end}}
    pub {{rustFieldName .Name}}: {{fieldRustType .}},
{{- end}}
}
{{- end}}
