All checks were successful
Build and Publish / build-release (push) Successful in 2m13s
142 lines
4.0 KiB
Elixir
142 lines
4.0 KiB
Elixir
defmodule CustomerServiceWeb.Schemas.Lead do
|
|
alias OpenApiSpex.Schema
|
|
|
|
defmodule PaginationMeta do
|
|
require OpenApiSpex
|
|
|
|
OpenApiSpex.schema(%{
|
|
title: "PaginationMeta",
|
|
type: :object,
|
|
properties: %{
|
|
total_count: %Schema{type: :integer},
|
|
total_pages: %Schema{type: :integer},
|
|
current_page: %Schema{type: :integer},
|
|
page_size: %Schema{type: :integer},
|
|
has_next: %Schema{type: :boolean},
|
|
has_prev: %Schema{type: :boolean}
|
|
}
|
|
})
|
|
end
|
|
|
|
defmodule LeadData do
|
|
require OpenApiSpex
|
|
|
|
OpenApiSpex.schema(%{
|
|
title: "QuickLead",
|
|
type: :object,
|
|
properties: %{
|
|
id: %Schema{type: :string, format: :uuid},
|
|
name: %Schema{type: :string},
|
|
email: %Schema{type: :string, format: :email},
|
|
phone: %Schema{type: :string},
|
|
company_name: %Schema{type: :string},
|
|
status: %Schema{
|
|
type: :string,
|
|
enum: ["new", "contacted", "qualified", "proposal", "negotiation", "converted", "lost"]
|
|
},
|
|
priority: %Schema{type: :string, enum: ["low", "medium", "high"]},
|
|
source: %Schema{
|
|
type: :string,
|
|
enum: ["website", "referral", "social_media", "cold_call", "email_campaign", "other"]
|
|
},
|
|
notes: %Schema{type: :string},
|
|
assigned_to: %Schema{type: :string},
|
|
estimated_value: %Schema{type: :string},
|
|
expected_close_date: %Schema{type: :string, format: :date},
|
|
status_history: %Schema{type: :array, items: %Schema{type: :object}},
|
|
inserted_at: %Schema{type: :string, format: :"date-time"},
|
|
updated_at: %Schema{type: :string, format: :"date-time"}
|
|
}
|
|
})
|
|
end
|
|
|
|
defmodule CreateQuickLead do
|
|
require OpenApiSpex
|
|
|
|
OpenApiSpex.schema(%{
|
|
title: "CreateQuickLead",
|
|
type: :object,
|
|
required: [:name],
|
|
properties: %{
|
|
name: %Schema{type: :string},
|
|
email: %Schema{type: :string, format: :email},
|
|
phone: %Schema{type: :string},
|
|
company_name: %Schema{type: :string},
|
|
status: %Schema{
|
|
type: :string,
|
|
enum: ["new", "contacted", "qualified", "proposal", "negotiation", "converted", "lost"]
|
|
},
|
|
priority: %Schema{type: :string, enum: ["low", "medium", "high"]},
|
|
source: %Schema{
|
|
type: :string,
|
|
enum: ["website", "referral", "social_media", "cold_call", "email_campaign", "other"]
|
|
},
|
|
notes: %Schema{type: :string},
|
|
assigned_to: %Schema{type: :string},
|
|
estimated_value: %Schema{type: :string},
|
|
expected_close_date: %Schema{type: :string, format: :date}
|
|
}
|
|
})
|
|
end
|
|
|
|
defmodule UpdateQuickLead do
|
|
require OpenApiSpex
|
|
|
|
OpenApiSpex.schema(%{
|
|
title: "UpdateQuickLead",
|
|
type: :object,
|
|
properties: %{
|
|
name: %Schema{type: :string},
|
|
email: %Schema{type: :string, format: :email},
|
|
phone: %Schema{type: :string},
|
|
company_name: %Schema{type: :string},
|
|
notes: %Schema{type: :string},
|
|
assigned_to: %Schema{type: :string},
|
|
estimated_value: %Schema{type: :string},
|
|
expected_close_date: %Schema{type: :string, format: :date}
|
|
}
|
|
})
|
|
end
|
|
|
|
defmodule UpdateLeadStatus do
|
|
require OpenApiSpex
|
|
|
|
OpenApiSpex.schema(%{
|
|
title: "UpdateLeadStatus",
|
|
type: :object,
|
|
required: [:status],
|
|
properties: %{
|
|
status: %Schema{
|
|
type: :string,
|
|
enum: ["new", "contacted", "qualified", "proposal", "negotiation", "converted", "lost"]
|
|
}
|
|
}
|
|
})
|
|
end
|
|
|
|
defmodule LeadListResponse do
|
|
require OpenApiSpex
|
|
|
|
OpenApiSpex.schema(%{
|
|
title: "LeadListResponse",
|
|
type: :object,
|
|
properties: %{
|
|
data: %Schema{type: :array, items: LeadData},
|
|
meta: PaginationMeta
|
|
}
|
|
})
|
|
end
|
|
|
|
defmodule LeadResponse do
|
|
require OpenApiSpex
|
|
|
|
OpenApiSpex.schema(%{
|
|
title: "LeadResponse",
|
|
type: :object,
|
|
properties: %{
|
|
data: LeadData
|
|
}
|
|
})
|
|
end
|
|
end
|