
                         v    d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZ d	 Zd
 Zd Zd Zd Zy)z@Arg parsing and other utilities for Essential Contacts commands.    )absolute_import)division)unicode_literalsN)
exceptions)	arg_utils)
propertiesc                 R    t        |       }t        |       }dj                  ||      S )zCReturns the full contact name from the args or raises an exception.z{}/contacts/{})GetContactId	GetParentformat)argscps      9lib/googlecloudsdk/command_lib/essential_contacts/util.pyGetContactNamer      s(    4!o!		 	 A	&&    c                 D    t        | j                         | j                  S N)_ValidateContact
CONTACT_ID)r   s    r   r
   r
   #   s    4??#	r   c                 \    t        j                  d|       st        j                  d|       y )Nz^[0-9]+$contact)rematchr   InvalidArgumentException)
flag_values    r   r   r   (   s(    	*j	)

-
-i
DD 
*r   c                 v   dt        d | j                  | j                  | j                  fD              k(  r7t        j
                  j                  j                  j                         | _        d}| j                  rd| j                  z  }|S | j                  rd| j                  z  }|S d| j                  z  }|S )zCReturns the parent resource from args or the active gcloud project.r   c              3   2   K   | ]  }t        |        y wr   )bool).0xs     r   	<genexpr>zGetParent.<locals>.<genexpr>/   s     NM!d1gMs   Nzprojects/%sz
folders/%szorganizations/%s)sumprojectfolderorganizationr   VALUEScore	GetOrFail)r   parents     r   r   r   -   s    #Ndkk4;L;LMN
NN $$))11;;=DL&	\\T\\)F 
- {{DKK'F 
-  $"3"33F	-r   c                     | j                   sg S | j                   D cg c]  }t        j                  ||       c}S c c}w r   )notification_categoriesr   ChoiceToEnum)r   "notification_category_enum_messagecategory_choices      r   GetNotificationCategoriesr0   ?   sP    		%	%I "99
 :/ _?A9
  
s   =)__doc__
__future__r   r   r   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.util.apisr   googlecloudsdk.corer   r   r
   r   r   r0    r   r   <module>r7      s:    G &  ' 	 . : *'
E
$r   