﻿var spec = new EntitySpecification();

function Page(id, src)
{
    this.Id = id;
    this.Src = src;
}

function Image(id, url, controlId, sectionContentId)
{
    this.Id = 0;
    this.Url = "";
    this.ControlId = "";
    this.SectionContentId = sectionContentId;
    
    if (spec.IsValid(id, url))
    {
        this.Id = id;
        this.Url = url;
        this.ControlId = controlId;
    }       
}

function AboutPage(id, name, text, pageId)
{
    this.Id = 0;
    this.Name = "";
    this.Text = text;
    this.PageId = pageId;
    
    if (spec.IsValid(id, name))
    {
        this.Id = id;
        this.Name = name;
    }
}

function Section(id, name, pageId)
{
    this.Id = 0;
    this.Name = "";
    this.PageId = pageId;
    
    if (spec.IsValid(id, name))
    {
        this.Id = id;
        this.Name = name;
    }
}

function SectionContent(id, name, content, sectionId)
{
    this.Id = 0;
    this.Name = "";
    this.Content = "";
    this.SectionId = sectionId;
    
    if (spec.IsValid(id, name))
    {
        this.Id = id;
        this.Name = name;
        this.Content = content;
    }        
}

function EntitySpecification()
{
    this.IsValid = function (id, name)
    {        
        if (id == undefined)
            return false;
        
        if (id <= 0)
            return false;                   
            
        return true;
    }
}

function Entity(id, name)
{
    this.Id = 0;
    this.Name = "";
    
    if (spec.IsValid(id, name))
    {
        this.Id = id;
        this.Name = name;
    }        
}

function Product(id, name, description, price, imageUrl, pageSectionId)
{
    this.Id = id;
    this.Name = name;
    this.Description = description;
    this.Price = price;
    this.ImageUrl = imageUrl;
    this.PageSectionId = pageSectionId;
}

function ProductAttribute(id, name, value, productId)
{
    this.Id = id;
    this.Name = name;
    this.Value = value;
    this.ProductId = productId;
}

function ShopContent(id, text, pageId)
{
    this.Id = id;
    this.Text = text;
    this.PageId = pageId;
}

function ShopPage(id, name, description, mainPageId)
{
    this.Id = id;
    this.Name = name;
    this.Description = description;
    this.MainPageId = mainPageId;
}

function ShopSection(id, name, description, pageId)
{
    this.Id = id;
    this.Name = name;
    this.Description = description;
    this.PageId = pageId;
}

function Album(id, name, albumCoverPhotoId, albumCoverPhotoUrl)
{
    this.Id = id;
    this.Name = name;
    this.AlbumCoverPhotoId = albumCoverPhotoId;
    this.AlbumCoverPhotoUrl = albumCoverPhotoUrl;
}

function Photo(id, url, iscover, albumId)
{
    this.Id = id;
    this.Url = url;
    this.IsCover = iscover;
    this.AlbumId = albumId;
}

function MusicWordsPage(id, name, pageId)
{
    this.Id = id;
    this.Name = name;
    this.PageId = pageId;
}

function MusicContent(id, title, text, description, imageUrl, itunesUrl, pageId)
{
    this.Id = id;
    this.Title = title;
    this.Description = description;
    this.Text = text;  
    this.ImageUrl = imageUrl;
    this.ItunesUrl = itunesUrl;
    this.PageId = pageId;
}

function MusicTrack(id, name, url, isFeatured, lyrics, itunesUrl, contentId)
{
    this.Id = id;
    this.Name = name;
    this.Url = url;
    this.IsFeatured = isFeatured;
    this.Lyrics = lyrics;
    this.ItunesUrl = itunesUrl;
    this.ContentId = contentId;    
}

function Poem (id, name, poem, pageId)
{
    this.Id = id;
    this.Name = name;
    this.Poem = poem;
    this.PageId = pageId;
}

function JusticePage(id, name, header)
{
    this.Id = id;
    this.Name = name;
    this.Header = header;
}

function JusticeSection(id, name, url, text, hasUrl, pageId)
{
    this.Id = id;
    this.Name = name;
    this.Url = url;
    this.Text = text;
    this.HasUrl = hasUrl;
    this.PageId = pageId;
}

function Contact(id, name, phone, email, address)
{
    this.Id = id;
    this.Name = name;
    this.Email = email;
    this.Phone = phone;
    this.Address = address;
}

function ContactText(id, headerText, subscribeText, commentsText, pageId)
{
    this.Id = id;
    this.HeaderText = headerText;
    this.SubscribeText = subscribeText;
    this.CommentsText = commentsText;
    this.PageId = pageId;
}

function MainPage(id, name, text)
{
    this.Id = id;
    this.Name = name;
    this.Text = text;
}

function MainSection(id, name, text, pageId)
{
    this.Id = id;
    this.Name = name;
    this.Text = text;
    this.PageId = pageId;
}

function SimpleMusicTrack(id, name, description)
{
    this.Id = id;
    this.Name = name;
    this.Description = description;
}

function ItunesUrl(id, name, url)
{
    this.Id = id;
    this.Name = name;
    this.Url = url;
}