using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;

namespace Insight.Domain.Models
{
    public class TokenRequest
    {
        [JsonPropertyName("username"), EmailAddress, Required]
        public string Username { get; set; }

        [JsonPropertyName("password"), DataType(DataType.Password), Required]
        public string Password { get; set; }

        [JsonPropertyName("code"), DataType(DataType.Text)]
        public string? Code { get; set; }
    }

    public class TokenResponse
    {
        [JsonPropertyName("access_token")]
        public string AccessToken { get; set; }

        [JsonPropertyName("expires_in")]
        public int ExpireInSeconds { get; set; }

        [JsonPropertyName("refresh_token")]
        public string RefreshToken { get; set; }
    }

    public class TokenRevokeRequest
    {
        [JsonPropertyName("token"), Required]
        public string Token { get; set; }

        [JsonPropertyName("reason")]
        public string? Reason { get; set; }

        public TokenRevokeRequest(string token, string? reason)
        {
            Token = token;
            Reason = reason;
        }
    }

    public class TokenRefreshRequest
    {
        [JsonPropertyName("token"), Required]
        public string Token { get; set; }

        public TokenRefreshRequest(string token)
        {
            Token = token;
        }
    }
}