﻿// -----------------------------------------------------------------------
// <copyright file="Deal.cs" company="Spardo, LLC">
// Copyright (c) 2011 SPardo, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a 
// copy of this software and associated documentation files (the "Software"), 
// to deal in the Software without restriction, including without limitation 
// the rights to use, copy, modify, merge, publish, distribute, sublicense, 
// and/or sell copies of the Software, and to permit persons to whom the 
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included 
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
// DEALINGS IN THE SOFTWARE.
// </copyright>
// -----------------------------------------------------------------------

namespace DotNet37Signals.Client.Highrise.Models
{
    using System;
    using System.Runtime.Serialization;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    [DataContract(Name = "deal", Namespace = "")]
    public class Deal
    {
        [DataMember(Name ="account-id", Order = 0)]
        public Int64 AccountId { get; set; }

        [DataMember(Name ="author-id", Order = 1)]
        public Int64 AuthorId { get; set; }

        [DataMember(Name ="background", Order = 2)]
        public string Background { get; set; }

        [DataMember(Name ="category-id", Order = 3)]
        public Int64 CategoryId { get; set; }

        [DataMember(Name ="created-at", Order = 4)]
        public DateTime CreatedAt { get; set; }

        [DataMember(Name ="currency", Order = 5)]
        public string Currency { get; set; }

        [DataMember(Name ="duration", Order = 6)]
        internal string NullableDuration { get; set; }

        [IgnoreDataMember]
        public Int64? Duration
        {
            get { return this.NullableDuration.ToNullableInt64(); }
            set { this.NullableDuration.FromNullableInt64(value); }
        }

        [DataMember(Name ="group-id", Order = 7)]
        internal string NullableGroupId { get; set; }

        [IgnoreDataMember]
        public Int64? GroupId
        {
            get { return this.NullableGroupId.ToNullableInt64(); }
            set { this.NullableGroupId.FromNullableInt64(value); }
        }

        [DataMember(Name ="id", Order = 8)]
        public Int64 Id { get; set; }

        [DataMember(Name = "name", Order = 9)]
        public string Name { get; set; }

        [DataMember(Name = "owner-id", Order = 10)]
        internal string NullableOwnerId { get; set; }

        [IgnoreDataMember]
        public Int64? OwnerId
        {
            get { return this.NullableOwnerId.ToNullableInt64(); }
            set { this.NullableOwnerId.FromNullableInt64(value); }
        }

        [DataMember(Name = "party-id", Order = 11)]
        public Int64 PartyId { get; set; }

        [DataMember(Name = "price", Order = 12)]
        public Int64 Price { get; set; }

        [DataMember(Name = "price-type", Order = 13)]
        public string PriceType { get; set; }

        [DataMember(Name = "responsible-party-id", Order = 14)]
        public Int64 ResponsiblePartyId { get; set; }

        [DataMember(Name = "status", Order = 15)]
        public string Status { get; set; }

        [DataMember(Name = "status-changed-on", Order = 16)]
        internal string NullableStatusChangedOn { get; set; }

        [IgnoreDataMember]
        public DateTime? StatusChangedOn
        {
            get { return this.NullableStatusChangedOn.ToNullableDateTime(); }
            set { this.NullableStatusChangedOn.FromNullableDateTime(value); }
        }

        [DataMember(Name = "updated-at", Order = 17)]
        public DateTime UpdatedAt { get; set; }

        [DataMember(Name = "visible-to", Order = 18)]
        public VisibleTo VisibleTo { get; set; }

        [DataMember(Name = "categories", Order = 19)]
        public Category Category { get; set; }

        [DataMember(Name ="parties", Order = 20)]
        public Parties Parties { get; set; }
    }
}
