import random
import copy

_shape_description = {"shape": "pendant",
                      "division_pattern": "linear",
                      "division_param1": 1.0,
                      "division_param2": 1.0,
                      "radius": 1.0,
                      "height": 1.0,
                      "fixture_radius": 0.3,
                      "fixture_length": 0.3,
                      "stem_length": 0.5,
                      "style": "dark"}

_styles = {"dark" : {"shade": (0.1, 0.1, 0.1),
            "chord": (0.05, 0.05, 0.05),
            "base": (0.05, 0.05, 0.05),
            "use_wall": True,
            "wall": (0.9, 0.9, 0.9)},
           "billard": {"shade": (0.1, 0.1, 0.1),
            "chord": (0.05, 0.05, 0.05),
            "base": (0.05, 0.05, 0.05),
            "use_wall": True,
            "wall": (0.9, 0.9, 0.9)},
           "light": {"shade": (0.1, 0.1, 0.1),
            "chord": (0.05, 0.05, 0.05),
            "base": (0.05, 0.05, 0.05),
            "use_wall": True,
            "wall": (0.9, 0.9, 0.9)},             
           }

_division_types = ["linear",
                   "logistic",
                   "sinusoid",
                   "hyperbolic_tan",
                   "circle"]

def get_random_shape_description(shape, bbox, feature_min):
    
    """
    Generate a random shape description and style
    """
    
    shape_description = copy.deepcopy(_shape_description)
    shape_description["shape"] = shape
    feature_height = feature_min[1] + random.random()*(bbox[1]-feature_min[1])
    feature_radius = feature_min[0] + random.random()*(bbox[0]-feature_min[0])
    shape_description["height"] = feature_height
    shape_description["radius"] = feature_radius
    shape_description["division_pattern"] = random.choice(_division_types)
    shape_description["style"] = random.choice(list(_styles.keys()))
    return shape_description