#!/bin/bash
name=${1%%\\*}

excluded_names=("backend" "product-template" "product-model" "basic")

for excluded_name in "${excluded_names[@]}"; do
    if [ "$name" = "$excluded_name" ]; then
        echo "不能在$name里使用"
        exit
    fi
done

echo $name
goctl api go -api server_api/$name.api -dir server/$name --home ./goctl_template/

# # List of API filenames without the '.api' extension
# api_names=("backend" "canteen" "home-user-auth" "map-library" "product" "product-template" "shopping-cart-confirmation" "webset" "data-transfer" "inventory" "orders" "product-model" "render" "upload" "assistant")

# # Iterate over API filenames and generate Go code, excluding certain names
# for api_name in "${api_names[@]}"; do
#     skip=false

#     for excluded_name in "${excluded_names[@]}"; do
#         if [ "$api_name" = "$excluded_name" ]; then
#             skip=true
#             break
#         fi
#     done

#     if [ "$skip" = true ]; then
#         continue
#     fi

#     echo "Generating Go code for $api_name"
#     goctl api go -api server_api/"$api_name".api -dir server/"$api_name" --home ./goctl_template/
# done