app:
  slug: conecta_guate
  name: Conecta Guate (Logística / Pedidos)
  group: logistics
  enabled: true

  capabilities:
    install: true
    uninstall: true
    update_settings: true
    events:
      - login

      - list_cross_products
      - get_cross_product
      - create_cross_product
      - delete_cross_product

      - list_departamentos
      - list_municipios_by_departamento
      - list_transportes
      - list_tipo_pago

      - quote_order
      - create_order
      - update_order
      - get_order_by_guia
      - download_guia_pdf

  settings:
    # Base & Auth
    base_url:    { type: url,    required: true, default: "https://ws.conectaguate.com" }
    address_origin:    { type: string,    required: true}
    name_origin:    { type: string,    required: true}
    phone_origin:      { type: string,    required: true}
    department_id:     { type: string,    required: true}
    city_id:     { type: string,    required: true}
    email:       { type: string, required: true }
    password:    { type: string, required: true, secret: true }
    remember_me: { type: boolean, required: false, default: true }
    conecta_guate_installed: { type: boolean, required: false, default: true }

    # Token handling
    token_type:  { type: string, required: false, default: "Bearer" }

  # Endpoints (configurables por si cambian)
  endpoints:
    auth_login: "/api/auth/login"


    usuario_information_create: "/api/v1/site/usuario/information/create"
    usuario_information_get:    "/api/v1/site/usuario/information"
    usuario_imagen_upload:      "/api/v1/site/usuario/imagen"

    cross_list:         "/api/v1/site/cross"
    cross_item:         "/api/v1/site/cross/item/{id}"
    cross_item_storage: "/api/v1/site/cross/item/storage"
    cross_item_img:     "/api/v1/site/cross/item/img/{id}"
    cross_delete:       "/api/v1/site/cross/delete/{id}"

    departamentos: "/api/v1/site/departamentos"
    municipios_by_depto: "/api/v1/site/departamentos/{id_departamento}"

    transportes: "/api/v1/site/transportes"
    tipo_pago:   "/api/v1/site/tipopago"

    pedido_cotizacion: "/api/v1/site/pedido/cotizacion"
    pedido_crear:      "/api/v1/site/pedido/crear"
    pedido_actualizar: "/api/v1/site/pedido/{id}/actualizar"
    pedido_by_guia:    "/api/v1/site/pedidio/guia/{guia}" 
    guia_pdf:          "/api/v1/site/pedido/guia/{key}"   

  validators:
    install:
      base_url: required|url
      email: required|string
      password: required|string

    update_settings:
      base_url: sometimes|url
      email: sometimes|string
      password: sometimes|string
      remember_me: sometimes|boolean
      token_type: sometimes|string

    events:
      login:
        email: sometimes|string
        password: sometimes|string
        remember_me: sometimes|boolean

      list_cross_products: {}

      get_cross_product:
        id: required|integer

      create_cross_product:
        producto_nombre: required|string
        producto_link: required|url

      delete_cross_product:
        id: required|integer

      list_departamentos: {}

      list_municipios_by_departamento:
        id_departamento: required|integer

      list_transportes: {}

      list_tipo_pago: {}

      quote_order:
        pedido: required|array
        detalle: required|array

      create_order:
        pedido: required|array
        detalle: required|array

      update_order:
        id: required|integer
        pedido: required|array
        detalle: required|array

      get_order_by_guia:
        guia: required|string

      download_guia_pdf:
        key: required|string

  adapter: App\Apps\Adapters\ConectaGuateAdapter
