4d764689e2
- Excel uyumlu CSV indirme - İçe aktarma: önce deneme raporu (geçerli / zaten var / satır satır hata), onayla geçerli satırlar - Sütunlar adla, esnek tutar/tarih yazımı, ; ve , ayırıcı, Windows-1254 desteği - Varlıkta tarih sırasına göre eldekinden fazla satış denetimi - Ayarlar sayfasında Veri bölümü Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
1.3 KiB
Rust
52 lines
1.3 KiB
Rust
//! 4 sabit ana grup (DATA_MODEL.md §2). Değiştirilemez, silinemez; veritabanında değil kodda.
|
||
|
||
use serde::{Deserialize, Serialize};
|
||
use ts_rs::TS;
|
||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, TS)]
|
||
#[serde(rename_all = "lowercase")]
|
||
#[ts(export)]
|
||
pub enum Group {
|
||
/// 🏠 Zorunlu
|
||
Needs,
|
||
/// 🛍️ İstek
|
||
Wants,
|
||
/// 📚 Kültürel
|
||
Culture,
|
||
/// ⚡ Beklenmeyen
|
||
Unexpected,
|
||
}
|
||
|
||
impl Group {
|
||
pub const ALL: [Group; 4] = [
|
||
Group::Needs,
|
||
Group::Wants,
|
||
Group::Culture,
|
||
Group::Unexpected,
|
||
];
|
||
|
||
pub fn as_str(self) -> &'static str {
|
||
match self {
|
||
Group::Needs => "needs",
|
||
Group::Wants => "wants",
|
||
Group::Culture => "culture",
|
||
Group::Unexpected => "unexpected",
|
||
}
|
||
}
|
||
|
||
/// Türkçe ad (CSV dışa/içe aktarma; arayüz metinleri `frontend/src/lib/groups.ts`)
|
||
pub fn label(self) -> &'static str {
|
||
match self {
|
||
Group::Needs => "Zorunlu",
|
||
Group::Wants => "İstek",
|
||
Group::Culture => "Kültürel",
|
||
Group::Unexpected => "Beklenmeyen",
|
||
}
|
||
}
|
||
|
||
/// Ekranda gösterim sırası
|
||
pub fn order(self) -> usize {
|
||
Self::ALL.iter().position(|g| *g == self).unwrap_or(0)
|
||
}
|
||
}
|