﻿/* Copyright (c) 2011-2012 Kamil Kaczmarczyk
 * 
 * This software is licensed as described in the file COPYING.txt, which
 * you should have received as part of this distribution. The terms
 * are also available at https://github.com/kamilk/PlantSaver/blob/master/COPYING.txt
 * 
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 */

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Runtime.Serialization;
using System.Data.Linq.Mapping;

namespace KeepYourPlantsAlive.Models
{
    [Table]
    public class StorablePlant
    {
        public StorablePlant()
        {
            this.Plant = new Plant();
        }

        public StorablePlant(Plant plant, string pictureFileName)
        {
            this.Plant = plant;
            this.PictureFileName = pictureFileName;
        }

        public Plant Plant
        {
            get;
            set;
        }

        [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
        public int IdInDatabase
        {
            get;
            set;
        }

        [Column(CanBeNull = true)]
        public string PictureFileName
        {
            get;
            set;
        }

        [Column(CanBeNull = false)]
        public String Name
        {
            get
            {
                return Plant.Name;
            }
            set
            {
                Plant.Name = value;
            }
        }

        [Column]
        public int WateringFrequency
        {
            get
            {
                return Plant.WateringFrequency;
            }
            set
            {
                Plant.WateringFrequency = value;
            }
        }
    }
}
