var Class = require("../class/Class.js").Class;
var BinaryData = require('./BinaryData.js').BinaryData;
var Types = require('../common/Types.js');

var FormData = function() {
    this.Extends = BinaryData;
    
    this.initialize = function(binaryData){
        this.parent(binaryData);
    };
    
    this.toString = function(){
        var fields = "";
        
        for (var field in this) {
            if(this.hasOwnProperty(field) && 
                !Types.isFunction(this[field]) &&
                field != 'caller' &&
                field[0] != '_') {
                fields += field.toString() + "=" + this[field] + "&";
            }
        }
        return fields.slice(0, -1);
    };
    
    this.toBuffer = function(){
        throw("NOT IMPLEMENTED");
    };
    
    this.toUTF8String = function(){
        throw("NOT IMPLEMENTED");
    };
    
};

FormData = new Class(new FormData());
exports.FormData = FormData;
