﻿// -----------------------------------------------------------------------
// <copyright file="TodoItem.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.Basecamp.Models
{
    using System;
    using System.Runtime.Serialization;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    [DataContract(Name = "todo-item", Namespace = "")]
    public class TodoItem
    {
        [DataMember(Name = "commented-at", Order = 0)]
        internal string NullableCommentedAt { get; set; }

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

        [DataMember(Name = "comments-count", Order = 1)]
        public Int64 CommentsCount { get; set; }

        [DataMember(Name = "completed", Order = 2)]
        public bool Completed { get; set; }

        [DataMember(Name = "time-tracking", Order = 3)]
        public bool TimeTracking { get; set; }

        [DataMember(Name = "content", Order = 4)]
        public string Content { get; set; }

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

        [DataMember(Name = "creator-id", Order = 6)]
        public Int64 CreatorId { get; set; }

        [DataMember(Name = "due-at", Order = 7)]
        internal string NullableDueAt { get; set; }

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

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

        [DataMember(Name = "position", Order = 9)]
        public Int64 Position { get; set; }

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

        [DataMember(Name = "responsible-party-type", Order = 11)]
        public string ResponsiblePartyType { get; set; }

        [DataMember(Name = "todo-list-id", Order = 12)]
        public Int64 TodoListId { get; set; }

        [DataMember(Name = "updated-at", Order = 13)]
        internal string NullableUpdatedAt { get; set; }

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

        [DataMember(Name = "responsible-party-name", Order = 14)]
        public string ResponsiblePartyName { get; set; }

        [DataMember(Name = "created-on", Order = 15)]
        public DateTime CreatedOn { get; set; }

        [DataMember(Name = "creator-name", Order = 16)]
        public string CreatorName { get; set; }
    }
}
