﻿function Listing(mlsNumber, mlsBoard, mlsBoardId, price, streetAddress, unit, city, state, zip,
    displayPropertyType, propertyType, propertySubType, rooms, bedrooms, bathrooms, fullBaths, partBaths, lat, lng, sibcyYN, openHouse,
    displayDetailsLink, displayPhoto) {
    this.mlsNumber = mlsNumber;
    this.mlsBoard = mlsBoard;
    this.mlsBoardId = mlsBoardId;
    this.price = price;
    this.streetAddress = streetAddress;
    this.unit = unit;
    this.city = city;
    this.state = state;
    this.zip = zip;
    this.displayPropertyType = displayPropertyType;
    this.propertyType = propertyType;
    this.propertySubType = propertySubType;
    this.rooms = rooms;
    this.bedrooms = bedrooms;
    this.bathrooms = bathrooms;
    this.fullBaths = fullBaths;
    this.partBaths = partBaths;
    this.lat = lat;
    this.lng = lng;
    this.sibcyYN = sibcyYN;
    this.openHouse = openHouse;
    this.displayDetailsLink = displayDetailsLink;
    this.displayPhoto = displayPhoto;
}

Listing.resultToListing = function(record) {
    return new Listing(
        record.ML_Number,
        record.Board,
        record.BoardID,
        record.SearchPrice.toString(),
        record.streetaddress,
        record.Unit,
        record.City,
        record.State,
        record.ZipCode,
        record.displayPropType,
        record.PropertyType,
        record.PropertySubType,
        record.Rooms,
        record.Bedrooms,
        record.Bathrooms,
        record.FullBaths,
        record.PartBaths,
        parseFloat(record.Latitude),
        parseFloat(record.Longitude),
        record.SibcyYN,
        (record.openHouse == 1) ? true : false,
        true,
        true);
}
