using backstage.Models.Users;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace backstage.Models.TokenVault
{
    public class TokenVault

    {
        public int vault_id { get; set; }
        public int merchant_id { get; set; }

        public string name { get; set; }
        public string url { get; set; }
        public string desc { get; set; }
        public int type { get; set; }
        public int enabled { get; set; }
        public DateTime created { get; set; }
        public int tokenCount { get; set; }
        public int userCount { get; set; }


    }
    public class TokenVaultForCreate

    {
        public int type { get; set; } = 1;
        public int merchant_id { get; set; }

        public string name { get; set; }
        public string url { get; set; } = "";
        public string description { get; set; }


    }
    public class TokenVaultResponse
    {
        public int r { get; set; }
        public string m { get; set; }
        public string flags { get; set; }
        //public int count { get; set; }
        public List<TokenVault> info { get; set; }
    }

    public class Field
    {
        public int id { get; set; }
        public string name { get; set; }
        public string desc { get; set; }
        public string format_exp { get; set; }
        public int Enabled { get; set; }
        public string key_id { get; set; }
        public List<User> users { get; set; }
        public List<Mask> masks { get; set; }
    }

    public class FieldForCreate
    {
        public int merchant_id { get; set; }
        public int vault_id { get; set; }
        public string name { get; set; }
        public string desc { get; set; }
        public string format_exp { get; set; }
        public int enabled { get; set; }
       
    }

    public class FieldsResponse
    {
        public int r { get; set; }
        public string m { get; set; }
        public string flags { get; set; }
        public List<string> failInfo { get; set; }
    
        //public int count { get; set; }
        public List<Field> fields { get; set; }
    }


    public class Mask
    {
        public int id { get; set; }
        public string name { get; set; }
        public int type { get; set; }//0:資料遮罩 *號  , 1:資料亂碼 相同格式 數字或文字替換
        public int is_unique { get; set; }
        public string setting { get; set; }

        public int size_init { get; set; } //mask 開頭不加密的字數 (用於 mask 1 and mask 3
        public int size_end { get; set; }//  mask結尾不加密的字數(用於 mask 1 and mask 3)

        public int mask { get; set; }  //0:no masking, 1:no encrypt string[0] to string[size_init] and string[size_end] to end of string, 2:skip string, 3:combine mask 1 and 2
        public string toskip { get; set; }//不 encrypt 的部分(用於 mask 2 and  mask 3)


      
    }

    public class Permission
    {
        public int id { get; set; }
        public int merchant_id { get; set; }
        public int user_id { get; set; }
        public string username { get; set; }
        public int vault_idvault_id { get; set; }
        public int access_code { get; set; }
        public int enable { get; set; }
        public string created { get; set; }
        public string modified { get; set; }



    }


}
