using System.ComponentModel.DataAnnotations;

namespace Application.DTOs{{ GroupNamespace }}.{{ TableNamePascal }}
{
    /// <summary>
    /// Data transfer object for creating {{ TableNamePascal }}
    /// </summary>
    public class Create{{ TableNamePascal }}Dto
    {
{% for col in NonPrimaryColumns -%}
{%- if col.CSharpType == 'string' and not col.IsNullable -%}
        /// <summary>
        /// {{ col.NamePascal }}
        /// </summary>
        [Required(ErrorMessage = "{{ col.NamePascal }} is required")]
        [StringLength(255, ErrorMessage = "{{ col.NamePascal }} cannot exceed 255 characters")]
        public {{ col.CSharpType }} {{ col.NamePascal }} { get; set; } = string.Empty;

{%- elif col.CSharpType == 'string' -%}
        /// <summary>
        /// {{ col.NamePascal }}
        /// </summary>
        [StringLength(255, ErrorMessage = "{{ col.NamePascal }} cannot exceed 255 characters")]
        public string? {{ col.NamePascal }} { get; set; }

{%- elif not col.IsNullable and col.CSharpType in ['int', 'long', 'decimal', 'double'] -%}
        /// <summary>
        /// {{ col.NamePascal }}
        /// </summary>
        [Required(ErrorMessage = "{{ col.NamePascal }} is required")]
        [Range(1, {{ 'long' if col.CSharpType == 'long' else 'int' }}.MaxValue, ErrorMessage = "{{ col.NamePascal }} must be greater than 0")]
        public {{ col.CSharpType }} {{ col.NamePascal }} { get; set; }

{%- elif col.CSharpType == 'DateTime' and not col.IsNullable -%}
        /// <summary>
        /// {{ col.NamePascal }}
        /// </summary>
        [Required(ErrorMessage = "{{ col.NamePascal }} is required")]
        public {{ col.CSharpType }} {{ col.NamePascal }} { get; set; }

{%- else -%}
        /// <summary>
        /// {{ col.NamePascal }}
        /// </summary>
        public {{ col.CSharpType }} {{ col.NamePascal }} { get; set; }

{%- endif %}
{% endfor -%}
    }
}