/**
 * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Component of: Red Hat Application Server
 * 
 * Initial Developers: Aizaz Ahmed
 *                     Vivek Lakshmanan
 *                     Andrew Overholt
 *                     Matthew Wringe
 *
 */

package olstore.form;


import java.util.Vector;

import olstore.dto.PictureValue;
import olstore.dto.PropertyValue;


public class CreateItemForm extends DemoBaseForm {
    
    
    private String ItemId = null;
    private String Name = null;
    private String Price = null;
    private String ShortDesc = null;
    private String LongDesc = null;
    private String TypeId = null;
    private Boolean MainPage = new Boolean ( false );
    private Boolean SpecialOffer= new Boolean ( false );
    
    private String NumPics = null;
    private String NumProps = null;
    private String Submit = null;
    
    private Vector Properties = new Vector() ;
    private Vector Pictures = new Vector();
    
    
    public String getItemId () {
        return this.ItemId;
    }
    public void setItemId ( String itemId ) {
        this.ItemId = itemId;
    }
    
    public String getName () {
        return this.Name;
    }
    public void setName ( String name ) {
        this.Name = name;
    }
    
    public String getPrice () {
        return this.Price;
    }
    public void setPrice ( String price ) {
        this.Price= price;
    }
    
    public String getShortDesc () {
        return this.ShortDesc;
    }
    public void setShortDesc ( String shortDesc ) {
        this.ShortDesc= shortDesc;
    }
    
    public String getLongDesc () {
        return this.LongDesc;
    }
    public void setLongDesc ( String longDesc) {
        this.LongDesc = longDesc;
    }
    
    public String getTypeId () {
        return this.TypeId ;
    }
    public void setTypeId ( String typeId ) {
        this.TypeId = typeId ;
    }
    
    public Boolean getMainPage() {
        return this.MainPage;
    }
    public void setMainPage ( Boolean mainPage) {
        this.MainPage= mainPage;
    }
    
    public Boolean getSpecialOffer () {
        return this.SpecialOffer;
    }
    public void setSpecialOffer ( Boolean specialOffer ) {
        this.SpecialOffer = specialOffer ;
    }
    
    
    /**
     * This autoincrements the size of the vector, so will not return null
     * . This is necessary as the struts auto-populater expects
     * non-null to be retured, and we don't know how many it will
     * request.
     * TODO: CAN LIKELY NOW CHANGE THIS TO NOT HAVE TO RETURN
     * A CUMBERSOME ARRAY
     */
    public PropertyValue getProp (int index) {
        if ( index >= Properties.size() ) {
            int size = Properties.size();
            for ( int i =0; i < (index-size) + 1 ; i++ ) {
                Properties.add ( new PropertyValue() );
            }
        }
        return (PropertyValue) Properties.get ( index );
    }
    
    public void setProp ( int index, PropertyValue property ) {
        Properties.set ( index, property );
    }
    
    /**
     * Returns a reference to the internal Properties, use wisely
     */
    public Vector getProperties( ) {
        return Properties;
    }
    
    public void setProperties ( Vector props ) {
        Properties = props;
    }
    
    /**
     * This autoincrements the size of the vector, so will not return null
     * . This is necessary as the struts auto-populater expects
     * non-null to be retured, and we don't know how many it will
     * request.
     * TODO: CAN LIKELY NOW CHANGE THIS TO NOT HAVE TO RETURN
     * A CUMBERSOME ARRAY
     */
    public PictureValue getPic (int index) {
        if ( index >= Pictures.size() ) {
            int size = Pictures.size();
            for ( int i =0; i < (index-size) + 1 ; i++ ) {
                Pictures.add ( new PictureValue() );
            }
        }
        return (PictureValue) Pictures.get ( index );
    }
    
    public void setPic ( int index, PictureValue picture ) {
        Pictures.set ( index, picture );
    }
    
    /**
     * Returns a reference to the internal Pictures, use wisely
     */
    public Vector getPictures( ) {
        return Pictures;
    }
    
    public void setPictures ( Vector pics ) {
        Pictures = pics ;
    }
    
    // Presentation specific fields 
    public String getNumPics () {
        return this.NumPics;
    }
    public void setNumPics ( String numPics ) {
        this.NumPics = numPics ;
    }
    
    public String getNumProps () {
        return this.NumProps;
    }
    public void setNumProps ( String numProps) {
        this.NumProps = numProps;
    }
    
    public String getSubmitType () {
        return this.Submit;
    }
    public void setSubmitType ( String submit ) {
        this.Submit = submit;
    }
    
}
