using Meezi.API.Models.Branches;
using Meezi.API.Validators;
using Meezi.Core.Utilities;
using Xunit;

namespace Meezi.API.Tests;

public class BranchPhaseATests
{
    [Fact]
    public void CreateBranchRequestValidator_requires_valid_login_phone()
    {
        var validator = new CreateBranchRequestValidator();
        var invalid = validator.Validate(new CreateBranchRequest("شعبه", "123", null, null, null, null));
        Assert.False(invalid.IsValid);

        var valid = validator.Validate(new CreateBranchRequest("شعبه", "09121234567", "علی", null, null, null));
        Assert.True(valid.IsValid);
    }

    [Fact]
    public void PhoneNormalizer_aligns_branch_login_phones()
    {
        Assert.Equal("09121234567", PhoneNormalizer.Normalize("0912 123 4567"));
        Assert.Equal("09121234567", PhoneNormalizer.Normalize("+989121234567"));
    }
}
