# encoding: utf-8

wb = xlsx_package.workbook

wb.add_worksheet(name: "Structure") do |sheet|
	heading = sheet.styles.add_style(:b => true, :locked => true)
	type = sheet.styles.add_style(:i => true)

	row = []
	row1 = []
	row2 = []

	@table.table_columns.asc(:order).each do |column|
		case column.type
		when "text"
			@site_in_use_locales.sort.each do |locale|
				row << column.title + " - " + t(locale.to_s)
				row1 << column.key
				row2 << column.type + "-#{locale}"
			end
		when "editor"
			@site_in_use_locales.sort.each do |locale|
				row << column.title + " - " + t(locale.to_s)
				row1 << column.key
				row2 << column.type + "-#{locale}"
			end
		when "image"
			row << column.title
			row1 << column.key
			row2 << "Please leave this column blank. Upload the image manually."
		when "date"
			row << column.title
			row1 << column.key
			row2 << column.type + " : " + column.date_format.upcase
		when "period"
			row << column.title + "-From"
			row1 << column.key
			row2 << column.type + " : " + column.date_format.upcase + "-period_from"
			row << column.title + "-To"
			row1 << column.key
			row2 << column.type + " : " + column.date_format.upcase + "-period_to"
		end
	end

	sheet.add_row row, :style => heading
	sheet.add_row row1
	sheet.add_row row2, :style => type

end