using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;

namespace Blahblah.FlowerStory.Server.Controller;

/// <summary>
/// 事件参数
/// </summary>
public record EventParameter
{
    /// <summary>
    /// 花草唯一 id
    /// </summary>
    [Required]
    [FromForm(Name = "flowerId")]
    public required int FlowerId { get; init; }

    /// <summary>
    /// 事件分类 id
    /// </summary>
    [Required]
    [FromForm(Name = "categoryId")]
    public required int CategoryId { get; init; }

    /// <summary>
    /// 操作人姓名
    /// </summary>
    [Required]
    [FromForm(Name = "byUser")]
    public required string ByUser { get; init; }

    /// <summary>
    /// 备注
    /// </summary>
    [FromForm(Name = "memo")]
    public string? Memo { get; set; }

    /// <summary>
    /// 纬度
    /// </summary>
    [FromForm(Name = "lat")]
    public double? Latitude { get; set; }

    /// <summary>
    /// 经度
    /// </summary>
    [FromForm(Name = "lon")]
    public double? Longitude { get; set; }

    /// <summary>
    /// 关联的照片
    /// </summary>
    [FromForm(Name = "photos")]
    public IFormFile[]? Photos { get; init; }
}

/// <summary>
/// 事件修改参数
/// </summary>
public record EventUpdateParameter : EventParameter
{
    /// <summary>
    /// 事件唯一 id
    /// </summary>
    [Required]
    [FromForm(Name = "id")]
    public required int Id { get; set; }
}
