using System;
using Composite.Core.WebClient.Renderings.Data;
using Composite.Data;
using Composite.Data.DynamicTypes;
using Composite.Data.Hierarchy;
using Composite.Data.Hierarchy.DataAncestorProviders;
using Composite.Data.Validation.Validators;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;

namespace Demo
{
    [AutoUpdateble]
    [DataScope("public")]
    [RelevantToUserType("Developer")]
    [DataAncestorProvider(typeof(NoAncestorDataAncestorProvider))]
    [ImmutableTypeId("fce15ce3-6ba0-4102-93b1-fd05394b8401")]
    [KeyTemplatedXhtmlRenderer(XhtmlRenderingType.Embedable, "<span>{label}</span>")]
    [KeyPropertyName("Id")]
    [Title("News")]
    [LabelPropertyName("Title")]
    public interface News : IData, IPageDataFolder, IPageRelatedData
    {
        [ImmutableFieldId("d2e8bc75-03e3-4c19-b022-2b50234bebcf")]
        [FunctionBasedNewInstanceDefaultFieldValue("<f:function name=\"Composite.Utils.Guid.NewGuid\" xmlns:f=\"http://www.composite.net" +
            "/ns/function/1.0\" />")]
        [StoreFieldType(PhysicalStoreFieldType.Guid)]
        [FieldPosition(0)]
        Guid Id { get; set; }

        [ImmutableFieldId("f1be5929-5724-47fd-91e2-da5d17bc078b")]
        [StoreFieldType(PhysicalStoreFieldType.String, 64)]
        [NotNullValidator]
        [FieldPosition(0)]
        [StringSizeValidator(0, 64)]
        [DefaultFieldStringValue("")]
        string Title { get; set; }

        [ImmutableFieldId("b45fd9a8-1eee-4527-84f1-105f1983c782")]
        [StoreFieldType(PhysicalStoreFieldType.DateTime)]
        [DateTimeRangeValidator("1753-01-01T00:00:00", "9999-12-31T23:59:59")]
        [FieldPosition(1)]
        [DefaultFieldNowDateTimeValue]
        DateTime Date { get; set; }

        [ImmutableFieldId("a72b01f5-b2a8-465b-a482-4d54bc2f2e9d")]
        [FormRenderingProfile(WidgetFunctionMarkup = @"<f:widgetfunction xmlns:f=""http://www.composite.net/ns/function/1.0"" name=""Composite.Widgets.String.TextArea"" />")]
        [StoreFieldType(PhysicalStoreFieldType.String, 1024)]
        [NotNullValidator]
        [FieldPosition(2)]
        [StringSizeValidator(0, 1024)]
        [DefaultFieldStringValue("")]
        string Content { get; set; }
    }
}