1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
mod inn;
mod theater;

use super::BuildingType;
use crate::world::place::{PlaceData, PlaceType};
use crate::world::Demographics;
use initiative_macros::WordList;
use rand::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, WordList)]
#[serde(into = "&'static str", try_from = "&str")]
pub enum BusinessType {
    #[term = "business"]
    #[alias = "shop"]
    #[alias = "store"]
    Any,

    Arena,
    Armorer,
    Bakery,
    Bank,
    #[alias = "nightclub"]
    #[alias = "pub"]
    Bar,
    Bathhouse,
    #[alias = "smithy"]
    Blacksmith,
    Brewery,
    #[alias = "gambling-hall"]
    Casino,
    Club,
    Distillery,
    FightingPit,
    FoodCounter,
    Forge,
    FurnitureShop,
    Furrier,
    GeneralStore,
    GuildHall,
    ImportsShop,
    #[alias = "caravansary"]
    #[alias = "hotel"]
    #[alias = "lodge"]
    #[alias = "tavern"]
    Inn,
    Jeweller,
    Lumberyard,
    MagicShop,
    Mill,
    PetStore,
    Restaurant,
    SpecialtyShop,
    SpiritsShop,
    Stable,
    TextilesShop,
    Theater,
    TradingPost,
    Vault,
    Wainwright,
    Warehouse,
    Weaponsmith,
    Woodshop,
}

impl BusinessType {
    pub const fn get_emoji(&self) -> Option<&'static str> {
        match self {
            Self::Arena => Some("🏛"),
            Self::Armorer => Some("🛡"),
            Self::Bakery => Some("🍞"),
            Self::Bank | Self::Vault => Some("🏦"),
            Self::Bar => Some("🍻"),
            Self::Bathhouse => Some("🛁"),
            Self::Blacksmith | Self::Weaponsmith => Some("🗡"),
            Self::Brewery => Some("🍻"),
            Self::Casino => Some("🃏"),
            Self::Club => Some(""),
            Self::Distillery => Some("🥃"),
            Self::FightingPit => Some("⚔"),
            Self::FoodCounter => Some("🍲"),
            Self::Forge => Some("🔥"),
            Self::FurnitureShop => Some("🪑"),
            Self::Furrier => Some("🦊"),
            Self::Inn => Some("🏨"),
            Self::Jeweller => Some("💍"),
            Self::Lumberyard => Some("🪵"),
            Self::MagicShop => Some("🪄"),
            Self::Mill => Some("🌾"),
            Self::PetStore => Some("🐶"),
            Self::Restaurant => Some("🍽"),
            Self::SpiritsShop => Some("🥃"),
            Self::Stable => Some("🐎"),
            Self::Theater => Some("🎭"),
            Self::Warehouse => Some("📦"),
            Self::Woodshop => Some("🪚"),

            Self::Any
            | Self::GeneralStore
            | Self::GuildHall
            | Self::ImportsShop
            | Self::SpecialtyShop
            | Self::TextilesShop
            | Self::TradingPost
            | Self::Wainwright => Some("🪙"),
        }
    }
}

pub fn generate(place: &mut PlaceData, rng: &mut impl Rng, demographics: &Demographics) {
    if let Some(PlaceType::Building(BuildingType::Business(subtype))) = place.subtype.value() {
        match subtype {
            BusinessType::Inn => inn::generate(place, rng, demographics),
            BusinessType::Theater => theater::generate(place, rng, demographics),
            _ => {}
        }
    }
}