github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/plugins/messagebird/types.go (about)

     1  // This file is part of the Smart Home
     2  // Program complex distribution https://github.com/e154/smart-home
     3  // Copyright (C) 2016-2023, Filippov Alex
     4  //
     5  // This library is free software: you can redistribute it and/or
     6  // modify it under the terms of the GNU Lesser General Public
     7  // License as published by the Free Software Foundation; either
     8  // version 3 of the License, or (at your option) any later version.
     9  //
    10  // This library is distributed in the hope that it will be useful,
    11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13  // Library General Public License for more details.
    14  //
    15  // You should have received a copy of the GNU Lesser General Public
    16  // License along with this library.  If not, see
    17  // <https://www.gnu.org/licenses/>.
    18  
    19  package messagebird
    20  
    21  import (
    22  	"github.com/e154/smart-home/common"
    23  	m "github.com/e154/smart-home/models"
    24  )
    25  
    26  const (
    27  	// Name ...
    28  	Name = "messagebird"
    29  	// AttrAccessKey ...
    30  	AttrAccessKey = "access_key"
    31  	// AttrName ...
    32  	AttrName = "name"
    33  	// AttrPhone ...
    34  	AttrPhone = "phone"
    35  	// AttrBody ...
    36  	AttrBody = "body"
    37  	// AttrPayment ...
    38  	AttrPayment = "Payment"
    39  	// AttrType ...
    40  	AttrType = "Type"
    41  	// AttrAmount ...
    42  	AttrAmount = "Amount"
    43  
    44  	Version = "0.0.1"
    45  )
    46  
    47  const (
    48  	// StatusDelivered ...
    49  	StatusDelivered = "delivered"
    50  )
    51  
    52  // NewAttr ...
    53  func NewAttr() m.Attributes {
    54  	return map[string]*m.Attribute{
    55  		AttrPayment: {
    56  			Name: AttrPayment,
    57  			Type: common.AttributeString,
    58  		},
    59  		AttrType: {
    60  			Name: AttrType,
    61  			Type: common.AttributeString,
    62  		},
    63  		AttrAmount: {
    64  			Name: AttrAmount,
    65  			Type: common.AttributeFloat,
    66  		},
    67  	}
    68  }
    69  
    70  // NewMessageParams ...
    71  func NewMessageParams() m.Attributes {
    72  	return map[string]*m.Attribute{
    73  		AttrPhone: {
    74  			Name: AttrPhone,
    75  			Type: common.AttributeString,
    76  		},
    77  		AttrBody: {
    78  			Name: AttrBody,
    79  			Type: common.AttributeString,
    80  		},
    81  	}
    82  }
    83  
    84  // NewSettings ...
    85  func NewSettings() m.Attributes {
    86  	return map[string]*m.Attribute{
    87  		AttrAccessKey: {
    88  			Name: AttrAccessKey,
    89  			Type: common.AttributeEncrypted,
    90  		},
    91  		AttrName: {
    92  			Name: AttrName,
    93  			Type: common.AttributeString,
    94  		},
    95  	}
    96  }
    97  
    98  // Balance ...
    99  type Balance struct {
   100  	Payment string
   101  	Type    string
   102  	Amount  float32
   103  }