﻿using System;

namespace Images
{
    /// <summary>
    /// Page marked with this attribute will be registered under provided URI <see cref="UriPartialVersion"/>
    /// with any permission checking disabled, but with Self.Only option.
    /// It will also be registered "publicly" with permission checking enabled under URI with "/partials"
    /// </summary>
    public sealed class PartialUrlAttribute: Attribute
    {
        /// <summary>
        /// Partial version URI
        /// </summary>
        public string UriPartialVersion { get; }

        /// <summary>
        /// Public version of URI
        /// </summary>
        public string UriApiVersion { get; }

        public PartialUrlAttribute(string uriPartialVersion)
        {
            UriPartialVersion = uriPartialVersion;
            UriApiVersion = uriPartialVersion.Replace(AppHelper.PartialUriPart, string.Empty);
        }
    }
}