/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
==================================================================== */

package org.apache.poi.xwpf.usermodel;

import java.util.HashMap;
import java.util.Map;

/**
 * Specifies all types of borders which can be specified for WordprocessingML
 * objects which have a border. Borders can be separated into two types:
 * <ul>
 * <li> Line borders: which specify a pattern to be used when drawing a line around the
 * specified object.
 * </li>
 * <li> Art borders: which specify a repeated image to be used
 * when drawing a border around the specified object. Line borders may be
 * specified on any object which allows a border, however, art borders may only
 * be used as a border at the page level - the borders under the pgBorders
 * element
 *</li>
 * </ul>
 * @author Gisella Bronzetti
 */
public class Borders {

    public static final Borders NIL = new Borders(1);

    public static final Borders NONE = new Borders(2);

    /**
     * Specifies a line border consisting of a single line around the parent
     * object.
     */
    public static final Borders SINGLE = new Borders(3);

    public static final Borders THICK = new Borders(4);

    public static final Borders DOUBLE = new Borders(5);

    public static final Borders DOTTED = new Borders(6);

    public static final Borders DASHED = new Borders(7);

    public static final Borders DOT_DASH = new Borders(8);

    public static final Borders DOT_DOT_DASH = new Borders(9);

    public static final Borders TRIPLE = new Borders(10);

    public static final Borders THIN_THICK_SMALL_GAP = new Borders(11);

    public static final Borders THICK_THIN_SMALL_GAP = new Borders(12);

    public static final Borders THIN_THICK_THIN_SMALL_GAP = new Borders(13);

    public static final Borders THIN_THICK_MEDIUM_GAP = new Borders(14);

    public static final Borders THICK_THIN_MEDIUM_GAP = new Borders(15);

    public static final Borders THIN_THICK_THIN_MEDIUM_GAP = new Borders(16);

    public static final Borders THIN_THICK_LARGE_GAP = new Borders(17);

    public static final Borders THICK_THIN_LARGE_GAP = new Borders(18);

    public static final Borders THIN_THICK_THIN_LARGE_GAP = new Borders(19);

    public static final Borders WAVE = new Borders(20);

    public static final Borders DOUBLE_WAVE = new Borders(21);

    public static final Borders DASH_SMALL_GAP = new Borders(22);

    public static final Borders DASH_DOT_STROKED = new Borders(23);

    public static final Borders THREE_D_EMBOSS = new Borders(24);

    public static final Borders THREE_D_ENGRAVE = new Borders(25);

    public static final Borders OUTSET = new Borders(26);

    public static final Borders INSET = new Borders(27);

    /**
     * Specifies an art border consisting of a repeated image of an apple
     */
    public static final Borders APPLES = new Borders(28);

    /**
     * Specifies an art border consisting of a repeated image of a shell pattern
     */
    public static final Borders ARCHED_SCALLOPS = new Borders(29);

    /**
     * Specifies an art border consisting of a repeated image of a baby pacifier
     */
    public static final Borders BABY_PACIFIER = new Borders(30);

    /**
     * Specifies an art border consisting of a repeated image of a baby rattle
     */
    public static final Borders BABY_RATTLE = new Borders(31);

    /**
     * Specifies an art border consisting of a repeated image of a set of
     * balloons
     */
    public static final Borders BALLOONS_3_COLORS = new Borders(32);

    /**
     * Specifies an art border consisting of a repeated image of a hot air
     * balloon
     */
    public static final Borders BALLOONS_HOT_AIR = new Borders(33);

    /**
     * Specifies an art border consisting of a repeating image of a black and
     * white background.
     */
    public static final Borders BASIC_BLACK_DASHES = new Borders(34);

    /**
     * Specifies an art border consisting of a repeating image of a black dot on
     * a white background.
     */
    public static final Borders BASIC_BLACK_DOTS = new Borders(35);

    /**
     * Specifies an art border consisting of a repeating image of a black and
     * white background
     */
    public static final Borders BASIC_BLACK_SQUARES = new Borders(36);

    /**
     * Specifies an art border consisting of a repeating image of a black and
     * white background.
     */
    public static final Borders BASIC_THIN_LINES = new Borders(37);

    /**
     * Specifies an art border consisting of a repeating image of a black and
     * white background.
     */
    public static final Borders BASIC_WHITE_DASHES = new Borders(38);

    /**
     * Specifies an art border consisting of a repeating image of a white dot on
     * a black background.
     */
    public static final Borders BASIC_WHITE_DOTS = new Borders(39);

    /**
     * Specifies an art border consisting of a repeating image of a black and
     * white background.
     */
    public static final Borders BASIC_WHITE_SQUARES = new Borders(40);

    /**
     * Specifies an art border consisting of a repeating image of a black and
     * white background.
     */
    public static final Borders BASIC_WIDE_INLINE = new Borders(41);

    /**
     * Specifies an art border consisting of a repeating image of a black and
     * white background
     */
    public static final Borders BASIC_WIDE_MIDLINE = new Borders(42);

    /**
     * Specifies an art border consisting of a repeating image of a black and
     * white background
     */
    public static final Borders BASIC_WIDE_OUTLINE = new Borders(43);

    /**
     * Specifies an art border consisting of a repeated image of bats
     */
    public static final Borders BATS = new Borders(44);

    /**
     * Specifies an art border consisting of repeating images of birds
     */
    public static final Borders BIRDS = new Borders(45);

    /**
     * Specifies an art border consisting of a repeated image of birds flying
     */
    public static final Borders BIRDS_FLIGHT = new Borders(46);

    /**
     * Specifies an art border consisting of a repeated image of a cabin
     */
    public static final Borders CABINS = new Borders(47);

    /**
     * Specifies an art border consisting of a repeated image of a piece of cake
     */
    public static final Borders CAKE_SLICE = new Borders(48);

    /**
     * Specifies an art border consisting of a repeated image of candy corn
     */
    public static final Borders CANDY_CORN = new Borders(49);

    /**
     * Specifies an art border consisting of a repeated image of a knot work
     * pattern
     */
    public static final Borders CELTIC_KNOTWORK = new Borders(50);

    /**
     * Specifies an art border consisting of a banner.
     * <p>
     * If the border is on the left or right; no border is displayed.
     * </p>
     */
    public static final Borders CERTIFICATE_BANNER = new Borders(51);

    /**
     * Specifies an art border consisting of a repeating image of a chain link
     * pattern.
     */
    public static final Borders CHAIN_LINK = new Borders(52);

    /**
     * Specifies an art border consisting of a repeated image of a champagne
     * bottle
     */
    public static final Borders CHAMPAGNE_BOTTLE = new Borders(53);

    /**
     * Specifies an art border consisting of repeating images of a compass
     */
    public static final Borders CHECKED_BAR_BLACK = new Borders(54);

    /**
     * Specifies an art border consisting of a repeating image of a colored
     * pattern.
     */
    public static final Borders CHECKED_BAR_COLOR = new Borders(55);

    /**
     * Specifies an art border consisting of a repeated image of a checkerboard
     */
    public static final Borders CHECKERED = new Borders(56);

    /**
     * Specifies an art border consisting of a repeated image of a Christmas
     * tree
     */
    public static final Borders CHRISTMAS_TREE = new Borders(57);

    /**
     * Specifies an art border consisting of repeating images of lines and
     * circles
     */
    public static final Borders CIRCLES_LINES = new Borders(58);

    /**
     * Specifies an art border consisting of a repeated image of a rectangular
     * pattern
     */
    public static final Borders CIRCLES_RECTANGLES = new Borders(59);

    /**
     * Specifies an art border consisting of a repeated image of a wave
     */
    public static final Borders CLASSICAL_WAVE = new Borders(60);

    /**
     * Specifies an art border consisting of a repeated image of a clock
     */
    public static final Borders CLOCKS = new Borders(61);

    /**
     * Specifies an art border consisting of repeating images of a compass
     */
    public static final Borders COMPASS = new Borders(62);

    /**
     * Specifies an art border consisting of a repeated image of confetti
     */
    public static final Borders CONFETTI = new Borders(63);

    /**
     * Specifies an art border consisting of a repeated image of confetti
     */
    public static final Borders CONFETTI_GRAYS = new Borders(64);

    /**
     * Specifies an art border consisting of a repeated image of confetti
     */
    public static final Borders CONFETTI_OUTLINE = new Borders(65);

    /**
     * Specifies an art border consisting of a repeated image of confetti
     * streamers
     */
    public static final Borders CONFETTI_STREAMERS = new Borders(66);

    /**
     * Specifies an art border consisting of a repeated image of confetti
     */
    public static final Borders CONFETTI_WHITE = new Borders(67);

    /**
     * Specifies an art border consisting of a repeated image
     */
    public static final Borders CORNER_TRIANGLES = new Borders(68);

    /**
     * Specifies an art border consisting of a dashed line
     */
    public static final Borders COUPON_CUTOUT_DASHES = new Borders(69);

    /**
     * Specifies an art border consisting of a dotted line
     */
    public static final Borders COUPON_CUTOUT_DOTS = new Borders(70);

    /**
     * Specifies an art border consisting of a repeated image of a maze-like
     * pattern
     */
    public static final Borders CRAZY_MAZE = new Borders(71);

    /**
     * Specifies an art border consisting of a repeated image of a butterfly
     */
    public static final Borders CREATURES_BUTTERFLY = new Borders(72);

    /**
     * Specifies an art border consisting of a repeated image of a fish
     */
    public static final Borders CREATURES_FISH = new Borders(73);

    /**
     * Specifies an art border consisting of repeating images of insects.
     */
    public static final Borders CREATURES_INSECTS = new Borders(74);

    /**
     * Specifies an art border consisting of a repeated image of a ladybug
     */
    public static final Borders CREATURES_LADY_BUG = new Borders(75);

    /**
     * Specifies an art border consisting of repeating images of a cross-stitch
     * pattern
     */
    public static final Borders CROSS_STITCH = new Borders(76);

    /**
     * Specifies an art border consisting of a repeated image of Cupid
     */
    public static final Borders CUP = new Borders(77);

    public static final Borders DECO_ARCH = new Borders(78);

    public static final Borders DECO_ARCH_COLOR = new Borders(79);

    public static final Borders DECO_BLOCKS = new Borders(80);

    public static final Borders DIAMONDS_GRAY = new Borders(81);

    public static final Borders DOUBLE_D = new Borders(82);

    public static final Borders DOUBLE_DIAMONDS = new Borders(83);

    public static final Borders EARTH_1 = new Borders(84);

    public static final Borders EARTH_2 = new Borders(85);

    public static final Borders ECLIPSING_SQUARES_1 = new Borders(86);

    public static final Borders ECLIPSING_SQUARES_2 = new Borders(87);

    public static final Borders EGGS_BLACK = new Borders(88);

    public static final Borders FANS = new Borders(89);

    public static final Borders FILM = new Borders(90);

    public static final Borders FIRECRACKERS = new Borders(91);

    public static final Borders FLOWERS_BLOCK_PRINT = new Borders(92);

    public static final Borders FLOWERS_DAISIES = new Borders(93);

    public static final Borders FLOWERS_MODERN_1 = new Borders(94);

    public static final Borders FLOWERS_MODERN_2 = new Borders(95);

    public static final Borders FLOWERS_PANSY = new Borders(96);

    public static final Borders FLOWERS_RED_ROSE = new Borders(97);

    public static final Borders FLOWERS_ROSES = new Borders(98);

    public static final Borders FLOWERS_TEACUP = new Borders(99);

    public static final Borders FLOWERS_TINY = new Borders(100);

    public static final Borders GEMS = new Borders(101);

    public static final Borders GINGERBREAD_MAN = new Borders(102);

    public static final Borders GRADIENT = new Borders(103);

    public static final Borders HANDMADE_1 = new Borders(104);

    public static final Borders HANDMADE_2 = new Borders(105);

    public static final Borders HEART_BALLOON = new Borders(106);

    public static final Borders HEART_GRAY = new Borders(107);

    public static final Borders HEARTS = new Borders(108);

    public static final Borders HEEBIE_JEEBIES = new Borders(109);

    public static final Borders HOLLY = new Borders(110);

    public static final Borders HOUSE_FUNKY = new Borders(111);

    public static final Borders HYPNOTIC = new Borders(112);

    public static final Borders ICE_CREAM_CONES = new Borders(113);

    public static final Borders LIGHT_BULB = new Borders(114);

    public static final Borders LIGHTNING_1 = new Borders(115);

    public static final Borders LIGHTNING_2 = new Borders(116);

    public static final Borders MAP_PINS = new Borders(117);

    public static final Borders MAPLE_LEAF = new Borders(118);

    public static final Borders MAPLE_MUFFINS = new Borders(119);

    public static final Borders MARQUEE = new Borders(120);

    public static final Borders MARQUEE_TOOTHED = new Borders(121);

    public static final Borders MOONS = new Borders(122);

    public static final Borders MOSAIC = new Borders(123);

    public static final Borders MUSIC_NOTES = new Borders(124);

    public static final Borders NORTHWEST = new Borders(125);

    public static final Borders OVALS = new Borders(126);

    public static final Borders PACKAGES = new Borders(127);

    public static final Borders PALMS_BLACK = new Borders(128);

    public static final Borders PALMS_COLOR = new Borders(129);

    public static final Borders PAPER_CLIPS = new Borders(130);

    public static final Borders PAPYRUS = new Borders(131);

    public static final Borders PARTY_FAVOR = new Borders(132);

    public static final Borders PARTY_GLASS = new Borders(133);

    public static final Borders PENCILS = new Borders(134);

    public static final Borders PEOPLE = new Borders(135);

    public static final Borders PEOPLE_WAVING = new Borders(136);

    public static final Borders PEOPLE_HATS = new Borders(137);

    public static final Borders POINSETTIAS = new Borders(138);

    public static final Borders POSTAGE_STAMP = new Borders(139);

    public static final Borders PUMPKIN_1 = new Borders(140);

    public static final Borders PUSH_PIN_NOTE_2 = new Borders(141);

    public static final Borders PUSH_PIN_NOTE_1 = new Borders(142);

    public static final Borders PYRAMIDS = new Borders(143);

    public static final Borders PYRAMIDS_ABOVE = new Borders(144);

    public static final Borders QUADRANTS = new Borders(145);

    public static final Borders RINGS = new Borders(146);

    public static final Borders SAFARI = new Borders(147);

    public static final Borders SAWTOOTH = new Borders(148);

    public static final Borders SAWTOOTH_GRAY = new Borders(149);

    public static final Borders SCARED_CAT = new Borders(150);

    public static final Borders SEATTLE = new Borders(151);

    public static final Borders SHADOWED_SQUARES = new Borders(152);

    public static final Borders SHARKS_TEETH = new Borders(153);

    public static final Borders SHOREBIRD_TRACKS = new Borders(154);

    public static final Borders SKYROCKET = new Borders(155);

    public static final Borders SNOWFLAKE_FANCY = new Borders(156);

    public static final Borders SNOWFLAKES = new Borders(157);

    public static final Borders SOMBRERO = new Borders(158);

    public static final Borders SOUTHWEST = new Borders(159);

    public static final Borders STARS = new Borders(160);

    public static final Borders STARS_TOP = new Borders(161);

    public static final Borders STARS_3_D = new Borders(162);

    public static final Borders STARS_BLACK = new Borders(163);

    public static final Borders STARS_SHADOWED = new Borders(164);

    public static final Borders SUN = new Borders(165);

    public static final Borders SWIRLIGIG = new Borders(166);

    public static final Borders TORN_PAPER = new Borders(167);

    public static final Borders TORN_PAPER_BLACK = new Borders(168);

    public static final Borders TREES = new Borders(169);

    public static final Borders TRIANGLE_PARTY = new Borders(170);

    public static final Borders TRIANGLES = new Borders(171);

    public static final Borders TRIBAL_1 = new Borders(172);

    public static final Borders TRIBAL_2 = new Borders(173);

    public static final Borders TRIBAL_3 = new Borders(174);

    public static final Borders TRIBAL_4 = new Borders(175);

    public static final Borders TRIBAL_5 = new Borders(176);

    public static final Borders TRIBAL_6 = new Borders(177);

    public static final Borders TWISTED_LINES_1 = new Borders(178);

    public static final Borders TWISTED_LINES_2 = new Borders(179);

    public static final Borders VINE = new Borders(180);

    public static final Borders WAVELINE = new Borders(181);

    public static final Borders WEAVING_ANGLES = new Borders(182);

    public static final Borders WEAVING_BRAID = new Borders(183);

    public static final Borders WEAVING_RIBBON = new Borders(184);

    public static final Borders WEAVING_STRIPS = new Borders(185);

    public static final Borders WHITE_FLOWERS = new Borders(186);

    public static final Borders WOODWORK = new Borders(187);

    public static final Borders X_ILLUSIONS = new Borders(188);

    public static final Borders ZANY_TRIANGLES = new Borders(189);

    public static final Borders ZIG_ZAG = new Borders(190);

    public static final Borders ZIG_ZAG_STITCH = new Borders(191);

    private final int value;

    private Borders(int val) {
        value = val;
    }

    public int getValue() {
        return value;
    }

	private static Borders[] values() {
		return new Borders[] { NIL, NONE, SINGLE, THICK, DOUBLE, DOTTED,
				DASHED, DOT_DASH, DOT_DOT_DASH, TRIPLE, THIN_THICK_SMALL_GAP,
				THICK_THIN_SMALL_GAP, THIN_THICK_THIN_SMALL_GAP,
				THIN_THICK_MEDIUM_GAP, THICK_THIN_MEDIUM_GAP,
				THIN_THICK_THIN_MEDIUM_GAP, THIN_THICK_LARGE_GAP,
				THICK_THIN_LARGE_GAP, THIN_THICK_THIN_LARGE_GAP, WAVE,
				DOUBLE_WAVE, DASH_SMALL_GAP, DASH_DOT_STROKED, THREE_D_EMBOSS,
				THREE_D_ENGRAVE, OUTSET, INSET, APPLES, ARCHED_SCALLOPS,
				BABY_PACIFIER, BABY_RATTLE, BALLOONS_3_COLORS,
				BALLOONS_HOT_AIR, BASIC_BLACK_DASHES, BASIC_BLACK_DOTS,
				BASIC_BLACK_SQUARES, BASIC_THIN_LINES, BASIC_WHITE_DASHES,
				BASIC_WHITE_DOTS, BASIC_WHITE_SQUARES, BASIC_WIDE_INLINE,
				BASIC_WIDE_MIDLINE, BASIC_WIDE_OUTLINE, BATS, BIRDS,
				BIRDS_FLIGHT, CABINS, CAKE_SLICE, CANDY_CORN, CELTIC_KNOTWORK,
				CERTIFICATE_BANNER, CHAIN_LINK, CHAMPAGNE_BOTTLE,
				CHECKED_BAR_BLACK, CHECKED_BAR_COLOR, CHECKERED,
				CHRISTMAS_TREE, CIRCLES_LINES, CIRCLES_RECTANGLES,
				CLASSICAL_WAVE, CLOCKS, COMPASS, CONFETTI, CONFETTI_GRAYS,
				CONFETTI_OUTLINE, CONFETTI_STREAMERS, CONFETTI_WHITE,
				CORNER_TRIANGLES, COUPON_CUTOUT_DASHES, COUPON_CUTOUT_DOTS,
				CRAZY_MAZE, CREATURES_BUTTERFLY, CREATURES_FISH,
				CREATURES_INSECTS, CREATURES_LADY_BUG, CROSS_STITCH, CUP,
				DECO_ARCH, DECO_ARCH_COLOR, DECO_BLOCKS, DIAMONDS_GRAY,
				DOUBLE_D, DOUBLE_DIAMONDS, EARTH_1, EARTH_2,
				ECLIPSING_SQUARES_1, ECLIPSING_SQUARES_2, EGGS_BLACK, FANS,
				FILM, FIRECRACKERS, FLOWERS_BLOCK_PRINT, FLOWERS_DAISIES,
				FLOWERS_MODERN_1, FLOWERS_MODERN_2, FLOWERS_PANSY,
				FLOWERS_RED_ROSE, FLOWERS_ROSES, FLOWERS_TEACUP, FLOWERS_TINY,
				GEMS, GINGERBREAD_MAN, GRADIENT, HANDMADE_1, HANDMADE_2,
				HEART_BALLOON, HEART_GRAY, HEARTS, HEEBIE_JEEBIES, HOLLY,
				HOUSE_FUNKY, HYPNOTIC, ICE_CREAM_CONES, LIGHT_BULB,
				LIGHTNING_1, LIGHTNING_2, MAP_PINS, MAPLE_LEAF, MAPLE_MUFFINS,
				MARQUEE, MARQUEE_TOOTHED, MOONS, MOSAIC, MUSIC_NOTES,
				NORTHWEST, OVALS, PACKAGES, PALMS_BLACK, PALMS_COLOR,
				PAPER_CLIPS, PAPYRUS, PARTY_FAVOR, PARTY_GLASS, PENCILS,
				PEOPLE, PEOPLE_WAVING, PEOPLE_HATS, POINSETTIAS, POSTAGE_STAMP,
				PUMPKIN_1, PUSH_PIN_NOTE_2, PUSH_PIN_NOTE_1, PYRAMIDS,
				PYRAMIDS_ABOVE, QUADRANTS, RINGS, SAFARI, SAWTOOTH,
				SAWTOOTH_GRAY, SCARED_CAT, SEATTLE, SHADOWED_SQUARES,
				SHARKS_TEETH, SHOREBIRD_TRACKS, SKYROCKET, SNOWFLAKE_FANCY,
				SNOWFLAKES, SOMBRERO, SOUTHWEST, STARS, STARS_TOP, STARS_3_D,
				STARS_BLACK, STARS_SHADOWED, SUN, SWIRLIGIG, TORN_PAPER,
				TORN_PAPER_BLACK, TREES, TRIANGLE_PARTY, TRIANGLES, TRIBAL_1,
				TRIBAL_2, TRIBAL_3, TRIBAL_4, TRIBAL_5, TRIBAL_6,
				TWISTED_LINES_1, TWISTED_LINES_2, VINE, WAVELINE,
				WEAVING_ANGLES, WEAVING_BRAID, WEAVING_RIBBON, WEAVING_STRIPS,
				WHITE_FLOWERS, WOODWORK, X_ILLUSIONS, ZANY_TRIANGLES, ZIG_ZAG,
				ZIG_ZAG_STITCH };
	}

    private static Map imap = new HashMap();
    static {
    	Borders[] values = values();
    	for (int i = 0; i < values.length; i++) {
    		Borders p = values[i];
            imap.put(new Integer(p.getValue()), p);
        }
    }

    public static Borders valueOf(int type) {
        Borders pBorder = (Borders) imap.get(new Integer(type));
        if (pBorder == null) {
            throw new IllegalArgumentException("Unknown paragraph border: " + type);
        }
        return pBorder;
    }
}
