package d2target

import 

const (
	NamePadding       = 10
	TypePadding       = 20
	ConstraintPadding = 20
	HeaderPadding     = 10

	// Setting table font size sets it for columns
	// The header needs to be a little larger for visual hierarchy
	HeaderFontAdd = 4
)

type SQLTable struct {
	Columns []SQLColumn `json:"columns"`
}

type SQLColumn struct {
	Name       Text     `json:"name"`
	Type       Text     `json:"type"`
	Constraint []string `json:"constraint"`
	Reference  string   `json:"reference"`
}

func ( SQLColumn) ( int) []*MText {
	return []*MText{
		{
			Text:     .Name.Label,
			FontSize: ,
			IsBold:   false,
			IsItalic: false,
			Shape:    "sql_table",
		},
		{
			Text:     .Type.Label,
			FontSize: ,
			IsBold:   false,
			IsItalic: false,
			Shape:    "sql_table",
		},
		{
			Text:     .ConstraintAbbr(),
			FontSize: ,
			IsBold:   false,
			IsItalic: false,
			Shape:    "sql_table",
		},
	}
}

func ( SQLColumn) () string {
	 := make([]string, len(.Constraint))

	for ,  := range .Constraint {
		switch  {
		case "primary_key":
			 = "PK"
		case "foreign_key":
			 = "FK"
		case "unique":
			 = "UNQ"
		}

		[] = 
	}

	return strings.Join(, ", ")
}