using InABox.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InABox.Poster.MYOB;

public class MYOBCompanyFileCredentials : BaseObject
{
    [EditorSequence(1)]
    [TextBoxEditor]
    public string UserID { get; set; } = "";

    [EditorSequence(2)]
    [PasswordEditor(ViewButtonVisible = true)]
    public string Password { get; set; } = "";

    [EditorSequence(3)]
    [CheckBoxEditor]
    public bool NoCredentials { get; set; } = false;

    protected override void DoPropertyChanged(string name, object? before, object? after)
    {
        base.DoPropertyChanged(name, before, after);

        if(name == nameof(NoCredentials) && NoCredentials)
        {
            UserID = "";
            Password = "";
        }
    }
}
