namespace Long.Utils.Verify;

/// <summary>
/// 验证码
/// </summary>
public static class VerificationCode
{
    /// <summary>
    /// 创建随机坐标
    /// </summary>
    /// <returns>坐标对象</returns>
    public static Coordinate CreateCoordinate()
    {
        return CreateCoordinate(300, 200);
    }

    /// <summary>
    /// 创建随机坐标
    /// </summary>
    /// <param name="maxX">X轴最大值</param>
    /// <param name="maxY">Y轴最大值</param>
    /// <returns>坐标对象</returns>
    public static Coordinate CreateCoordinate(int maxX, int maxY)
    {
        var coordinate = new Coordinate();
        if (maxX < 0)
        {
            coordinate.X = new Random().Next(maxX, 0);
        }
        else
        {
            coordinate.Y = new Random().Next(0, maxX);
        }
        if (maxY < 0)
        {
            coordinate.Y = new Random().Next(maxY, 0);
        }
        else
        {
            coordinate.Y = new Random().Next(0, maxY);
        }
        return coordinate;
    }
}

/// <summary>
/// 坐标
/// </summary>
public class Coordinate
{
    public int X;
    public int Y;
}
