# organization

Build and validate organization information

Canonical URL: https://docs.paradoc.dev/sdk/primitives/organization/

Build and validate organization information. The Organization primitive captures business entity details including legal names, registration numbers, and jurisdiction.

## Examples

### Creating organizations

```ts
// Object pattern
const org = p.organization({
  name: 'Acme Corporation'
})

// Builder pattern
const org = p.organization()
  .name('Acme Corporation')
  .legalName('Acme Corporation, Inc.')
  .domicile('Delaware')
  .entityType('corporation')
  .entityId('12345678')
  .taxId('12-3456789')
  .build()

// Copy and modify
const updated = p.organization()
  .from(org)
  .domicile('Nevada')
  .build()
```

### Parsing external data

```ts
// Parse unknown input (throws on error)
const org = p.organization.parse(jsonData)

// Safe parsing (returns result object)
const result = p.organization.safeParse(jsonData)
if (result.success) {
  console.log(`Organization: ${result.data.name}`)
} else {
  console.error(result.error.message)
}
```

### Using with forms

```ts
const form = p.form({
  name: 'vendor',
  fields: {
    company: { type: 'organization', label: 'Company Information' }
  }
})

const filled = form.fill({
  fields: {
    company: p.organization()
      .name('Tech Solutions LLC')
      .entityType('llc')
      .domicile('California')
      .build()
  }
})
```

## API

### Object Pattern

```ts
p.organization(input: Organization): Organization
```

Pass an Organization object for validation. Returns the validated Organization or throws on error.

```ts
const org = p.organization({ name: 'Global Enterprises' })
```

### Builder Pattern

Chain methods to build an Organization value incrementally:

Start with `p.organization()`. Each method returns `OrganizationBuilder` and can be chained.

| Method | Description |
| --- | --- |
| `name(value: string)` | Set organization display name |
| `legalName(value: string \| undefined)` | Set full legal name |
| `domicile(value: string \| undefined)` | Set jurisdiction of incorporation |
| `entityType(value: string \| undefined)` | Set entity type (corporation, llc, etc.) |
| `entityId(value: string \| undefined)` | Set registration/entity ID number |
| `taxId(value: string \| undefined)` | Set tax identification number |
| `from(value: Organization)` | Initialize from existing Organization |

Terminal methods return `Organization`.

| Method | Description |
| --- | --- |
| `build()` | Build and validate |

### Static Methods

| Method | Returns | Description |
| --- | --- | --- |
| `parse(input: unknown)` | `Organization` | Parse unknown input (throws on error) |
| `safeParse(input: unknown)` | `Result<Organization>` | Parse unknown input (returns result object) |

## Properties

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | Organization display name. |
| `legalName` | `string?` | Full legal name as registered. |
| `domicile` | `string?` | Jurisdiction of incorporation or registration. |
| `entityType` | `string?` | Type of legal entity. |
| `entityId` | `string?` | Registration or entity identification number. |
| `taxId` | `string?` | Tax identification number (EIN, VAT, etc.). |

## Common Entity Types

| Type                  | Description                   |
| --------------------- | ----------------------------- |
| `corporation`         | C-Corporation                 |
| `s_corp`              | S-Corporation                 |
| `llc`                 | Limited Liability Company     |
| `llp`                 | Limited Liability Partnership |
| `partnership`         | General Partnership           |
| `sole_proprietorship` | Sole Proprietorship           |
| `nonprofit`           | Non-profit Organization       |
| `trust`               | Trust Entity                  |

## Validation

The Organization primitive validates:

* `name` must be a non-empty string
* All other fields are optional

```ts
// Valid
p.organization({ name: 'Acme Inc' })
p.organization({
  name: 'Acme Inc',
  legalName: 'Acme Incorporated',
  entityType: 'corporation',
  domicile: 'Delaware'
})

// Invalid - throws Error
p.organization({})

p.organization({ name: '' })
```

## Related

* [Primitives Overview](/sdk/primitives) - All available primitives
* [Person](/sdk/primitives/person) - Individual person information
* [Organization Field](/sdk/artifacts/form/field#entity) - Organization field type
