<% if use_flag %>use serde::{Serialize, Deserialize};
use std::collections::HashSet;

<% end %>#[derive(Serialize, Deserialize, Debug, Eq, Hash, PartialEq, Clone)]
pub enum <%= class_name %> {<% ary.each do |it| %>
    #[serde(rename = "<%= it %>")]
    <%= it.ucc %>,<% end %>
}
<% if all_flag %>
impl <%= class_name %> {
    pub fn all() -> HashSet<Self> {
        let mut result = HashSet::new();<% ary.each do |it| %>
        result.insert(Self::<%= it.ucc %>);<% end %>
        result
    }<% methods.each do |it| %>

    pub fn <%= it[:name] %>() -> HashSet<Self> {
        let mut result = HashSet::new();<% it[:value].split(", ").each do |v| %>
        result.insert(Self::<%= v.ucc %>);<% end %>
        result
    }
    <% end %>
}
<% end %>
impl std::fmt::Display for <%= class_name %> {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {<% ary.each do |it| %>
            Self::<%= it.ucc %> => write!(f, "<%= it %>"),<% end %>
        }
    }
}

impl Default for <%= class_name %> {
    fn default() -> Self { Self::<%= ary.first.ucc %> }
}